Hi all!

I have following model classes:

Entity = sqlalchemy.ext.declarative.declarative_base(name='Entity')
class Ocean(Entity):
    __tablename__ = 'oceans'
    id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
    name = sqlalchemy.Column(sqlalchemy.String(20), nullable=False)
class Sea(Entity):
    __tablename__ = 'seas'
    id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
    name = sqlalchemy.Column(sqlalchemy.String(20), nullable=False)
    ocean_id = sqlalchemy.Column(sqlalchemy.String(20),
sqlalchemy.ForeignKey(Ocean.id))
    ocean = sqlalchemy.orm.relation(Ocean, backref='seas')

So instances of Ocean have seas property. The question is, if I have a
function:

def foo(entity_class, collection_property):
     # ...

that is called width args entity_class=Ocean,
collection_property='seas' could I anyhow to understand from within
this function that 'seas' is assotiated with Sea class and that
Sea.ocean is used to bind a Sea to the Ocean?

Is it ever possible? Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to