On 9/16/15 4:30 PM, Jonathan Vanasco wrote:
given the object `source`, these both work

            cols = [c.key for c in list(source.__table__.columns)]
cols = [c.name for c in sqlalchemy.orm.class_mapper(source.__class__).mapped_table.c]

I'm sure there are other ways.

is there an ideal / canonical way of getting this data?

for this particular instance, my biggest concern is speed.
if you want just the names and your concern is speed I'd say class.__table__.c.keys().

if you have more elaborate translations between table and mapping going on then inspect(class).columns.keys() or similar.








--
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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/d/optout.

Reply via email to