What's the recommended way to count the rows in a table. In SQL, I would
typically use select count(*) from table;
The statement "session.query(table).count()" issues a count(*) on a sub-query.
The docs say for finer control to use func.count
i.e. session.query(func.count(table.column)). That works, but you do have to
specify a table column.
session.query(func.count('table.*')) also appears to work, but issues a
parameterized query.
Is getting the count (however it's done) and checking for 0 the best way to
check for an empty table?
Mark
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.