from sqlalchemy.orm import class_mapper

mapper = class_mapper(MyClass)
table_name = mapper.local_table.name


On Oct 23, 2012, at 10:28 AM, Ji Zhang wrote:

> Hi,
> 
> I need to mapper a class to table which contains a dynamic table name like 
> tbl_data_20121023. When writing the __repr__ method, I want to print out the 
> mapped table name. How to do that?
> 
> def __repr__(self):
>     return '<%s: %s %s>' % (self.???tablename???, self.field1, self.field2)
> 
> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/6LOjYpvWLi4J.
> 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.

-- 
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.

Reply via email to