Samrat Man Singh Samrat Man Singh - 2 years ago 111
SQL Question

How to query database by id using SqlAlchemy?

I need to query a SQLAlchemy database by its

something similar to


but for id. How do I do this? [Searching over Google and SO didn't help]

Answer Source

Query has a get function that supports querying by ID.

For example, to query for an object with ID of 23: User.query.get(23)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download