Hi,
This might be a strange question, but I tried to find this in the documentation to no avail.
Is it possible to use something like load_only to override which columns are loaded in when loading a relationship (as in, a relationship that is not loaded at first with the original query)?
Something like:
class ModelB:
...
class ModelA:
model_b = relationship("ModelB")
model_a = session.query(ModelA).options(load_only(Model_b.only_field_i_want_in_the_future)).filter(ModelA.id==1).first()
It's a bit strange, but I want to ensure if someone loads the model_b property in the future, only specific columns are loaded in at first.
I can do this if I just query for model_b via the foreign key instead of using the relationship property, but I'd like to avoid that if possible.
Sorry if this question is a bit weird/confusing, it's kind of a strange use case.
Thanks,
Tony