I am trying to define a relationship that self-joins multiple columns on IS
NOT DISTINCT FROM. Since the backend I use does not support it, I mimic it
like this:
- notdistinct = lambda a, b: ~((a != b) | (a == None) | (b == None)) | ((a
== None) & (b == None))
- rel = relationship('Table',
- primaryjoin=lambda:
and_(notdistinct(Table.attr, foreign(remote(Table.attr))),
- #
...the same for several multiple attributes...
-
))
This works fine when when joining, but the lazy loading generates SQL like
this:
- WHERE
- NOT ("Table"."attr" != ? OR "Table"."attr" IS NULL OR
"Table"."attr" IS NULL) OR
- ("Table"."attr" IS NULL AND "Table"."attr" IS NULL)
- ....
Which is incorrect. Is there a way to help sqlalchemy identify where it
should substitute the parent key when it appears more than once?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.