carl carl - 6 months ago 3x
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

You can use sqlalchemy.sql.expression.null

from sqlalchemy.sql.expression import null
db.session.query(, null())