Hello!

I have a database with 10 tables with same structure. This structure of a 
tables are always the same.

I want to be able to query this tables using one declarative mapper instead 
of 10 similar mappers, but to do so i need a way to change table name 
somehow.

Desired code:

class T(Base):
   some_column = Column(Integer)  # just an example

table_a_results = 
session.query(T).select_from_table('table_a').filter(T.some_column > 
10).count()
table_b_results = 
session.query(T).select_from_table('table_b').filter(T.some_column > 
10).count()


Are there any possibility to implement such query feature? Are there any 
alternative variants to this feature?

Thanks!

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to