if you’re looking for an anonymous class that’s generated on the fly, you can 
take a look at sqlsoup: https://sqlsoup.readthedocs.org/en/latest/


On Nov 14, 2013, at 5:56 PM, Brendan Condon <[email protected]> wrote:

> I am using sqlalchemy 0.9 and flask / flask-sqlalchemy.
> 
> I want to pass in the name of a table and an id and get back the object.  I 
> use reflection to get the table object, but can't seem to a way to get from 
> the table object to the mapped object.  I feel like I am missing something 
> basic, but I have not been able to find a solution.  I appreciate your help.
> 
> Regards,
> 
> Brendan
> 
> <code>
> 
> def get_instance(table_name, instance_id):
> 
>     db.metadata.bind = db.engine
>     table = Table(table_name, db.metadata,
>                   autoload=True, autoload_with=db.engine)
> 
>     return table.query.filter(table.id == instance_id).one()
> 
> </code> 
> 
> -- 
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to