2

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(models.User.id, NULL)

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

1 Answer 1

3

You can use sqlalchemy.sql.expression.null

from sqlalchemy.sql.expression import null
db.session.query(models.User.id, null())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.