On Thu, Sep 26, 2019 at 11:39:52AM -0400, Mike Bayer wrote:
> that's not supported, I would suggest trying to solve your problem in a 
> different way.
> 

Ok, that's what I thought.. thanks!

I have a typical joined table inheritance, with Content being the "base"
class, and childs as Document, Folder, Event, etc.

I have added a transparent translation package with the "one translation
table per entity" approach (also using joined table inheritance),
and hybrid properties.  

So I have ContentTranslation being the "base" class, and childs like 
DocumentTranslation, FolderTranslation, EventTranslation, etc. which
contain translation fields specific to each class.

You helped me some weeks ago on this and I ended with (1), in which two 
relationships were added to every children of Content
("current_translation" and "translations"), and hybrid properties
pointing to their dedicated translation class. 

It works well, the only minor issue is that I don't have any
relationship on the base Content class (as you told me in the past that
overriding relationships could be problematic).

I made some modifications (2) in which the relationships are now
prefixed with the class name, and added two properties which point to
the class relationship, so that in the end:

- Content has a "content_current_translation" and 
"content_translations" relationships, and two property
"current_translation" and "translations" pointing to them

- Document has a "document_current_translation" and
"document_translations" with also two property current_translation and
translations pointing to them, but the minor issue is that the
content_current_translation is also joined loaded, which I'd like to
avoid.. and I'm wondering what would be the best approach.

I don't know if it's clear, but if it is not I could make a test case

(1) 
https://github.com/silenius/amnesia_multilingual/blob/master/amnesia_multilingual/builders.py

(2) 
https://github.com/silenius/amnesia_multilingual/blob/dev/amnesia_multilingual/builders.py

Thank you :)

Julien

> 
> 
> On Thu, Sep 26, 2019, at 11:25 AM, Julien Cigar wrote:
> > Hello,
> > 
> > I'd like to change a lazy property of an existing relationship (from
> > 'joined' to 'noload'). I tried the following:
> > 
> > mapper = orm.class_mapper(MyClass)
> > prop = mapper.get_property('some_relationship')
> > prop.lazy = 'noload'
> > 
> > but it doesn't seems to work, as the property is still loaded
> > 
> > Any idea if this is possible?
> > 
> > Thanks,
> > Julien
> > 
> > 
> > -- 
> > Julien Cigar
> > Belgian Biodiversity Platform (http://www.biodiversity.be)
> > PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0
> > No trees were killed in the creation of this message.
> > However, many electrons were terribly inconvenienced.
> > 
> > -- 
> > SQLAlchemy - 
> > The Python SQL Toolkit and Object Relational Mapper
> > 
> > http://www.sqlalchemy.org/
> > 
> > To post example code, please provide an MCVE: Minimal, Complete, and 
> > Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> > description.
> > --- 
> > 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 view this discussion on the web visit 
> > https://groups.google.com/d/msgid/sqlalchemy/20190926152504.GB1535%40p52s.
> > 
> 
> -- 
> SQLAlchemy - 
> The Python SQL Toolkit and Object Relational Mapper
> 
> http://www.sqlalchemy.org/
> 
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example.  See  http://stackoverflow.com/help/mcve for a full 
> description.
> --- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/dab6e523-675f-4a88-aa6d-c303360a50e6%40www.fastmail.com.

-- 
Julien Cigar
Belgian Biodiversity Platform (http://www.biodiversity.be)
PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/20190927102658.GA16334%40home.lan.

Attachment: signature.asc
Description: PGP signature

Reply via email to