How can I find out (based on the given code) if an attribute is a
foreign key, a primary key or nothing of that?

    insp = sqlalchemy.inspection.inspect(model)
    attrs = insp.attrs

    for attr in attrs:
        print('{}="{}"'.format(attr.key, attr.value)

The SQLA-docu is still quite hard for me. e.g. The "key" attribute is
not in my documentation.
<file:///usr/share/doc/python-sqlalchemy-doc/html/orm/internals.html#sqlalchemy.orm.state.AttributeState>

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to