Is it possible to ask query object to retrieve all columns but the Foreign and Primary key?
session_object.query(Table_Class).all(exclude={pk:True,fk=True})
Currently I am manually removing them after I get them back.
Is it possible to ask query object to retrieve all columns but the Foreign and Primary key?
session_object.query(Table_Class).all(exclude={pk:True,fk=True})
Currently I am manually removing them after I get them back.
The closest thing I found was an 'except_', which would you require you create 3 separate queries. Not sure if this would be worth it for you or not. I'm guessing probably not.
q1 = sess.query(SomeClass.id).all()
q2 = sess.query(SomeClass).all()
q3 = q1.except_(q2)
Source -> https://docs.sqlalchemy.org/en/14/orm/query.html?highlight=except#sqlalchemy.orm.Query.except_