carl carl - 2 years ago 111
SQL Question

adding a null column to s selection in sqlalchemy

Hi is is possible to get a null column in sqlalchemy? For example I would like to select all user ids together with a NULL column

db.session.query(, NULL)

The reason for this is that I need to do a UNION, which requires the same number of columns...

rmn rmn
Answer Source

You can use sqlalchemy.sql.expression.null

from sqlalchemy.sql.expression import null
db.session.query(, null())
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download