ORM code example for a query of a single table

16 views
Skip to first unread message

SF Markus Elfring

unread,
Jan 15, 2015, 3:55:51 PM1/15/15
to sqlal...@googlegroups.com
Hello,

I would like to query a single table by the ORM interface
for an export of the stored data into an other file format.

The description of the query API refers also to the object
relational tutorial. This tutorial explains also functionality
which deals with table creation. I imagine that I can omit
a few statements (like "Base.metadata.create_all(engine)")
there if I want to concentrate on a specific data selection.

How many meta-data will I need to add to the corresponding
class so that the declarative mapping will work for an
existing database table?
Will table properties be automatically mapped into the
provided Python class (without explicit specifications)?

Regards,
Markus

Jonathan Vanasco

unread,
Jan 15, 2015, 5:40:12 PM1/15/15
to sqlal...@googlegroups.com, elf...@users.sourceforge.net
Take a look at sqlacodegen


It can build the Python classes (sqlalchemy declarative) from your existing database.
Reply all
Reply to author
Forward
0 new messages