cannot drop sequence sequence_ticket_number because other objects depend on it
ticket_number = db.Column( db.Integer, sequence_ticket_number, server_default=sequence_ticket_number.next_value(), autoincrement=True, nullable=False)
I have a O2M relationship that I set to
Now I want to use the relationship
User.addresses in a query:
result = await async_session.execute(User.addresses.statement)
But it complains saying
AttributeError: 'InstrumentedList' object has no attribute 'statement'
I don't want to change the
lazy so that I don't accidentally call it.
Another question: How to
selectinload on the same table?
User - O2M - Addresses
User - M2O (FK) - Group
This doesn't work:
you should not chain them since aggresses is not part of Group. they should be separated by comma, since are both "top level" (of user)
lazy="raise", which would raise an exception each time I try to access the respective attribute. Is there a way to load such an "unloaded" relationship after I have already obtained the object from the ORM? According to the documentation,
Session.refresh()doesn't automatically refresh unloaded relationships. How do I load the relationship, then? I'm aware of
joinedload()& friends, but in case of a large object graph I would like to avoid eagerly loading the whole database with every single query.