Re: [sqlalchemy] How can I use a composite foreign-key constraint with a "mixin" class using declarative?

2020-09-02 Thread Nicolas Lykke Iversen
Thank you, Simon. Yes, __table_args__ is the only reason I’m creating separate modules. Where do you see that arguments that don’t match the database dialect of the engine get ignored? I looked at the source code for answering this question myself, but couldn't find an answer to that question. W

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Mike Bayer
well you are giving Name an inherit condition that conflicts with how you set up the foreign key. Name.node_id FKs to Property.node_id but then inherit condition is Name.node_id -> Node.node_id There seems to be a little unsmoothness to actually being able to configure it that way, that is,

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Richard Damon
Here is the code, note in all cases node_id  are foreign key/primary_key to a primary_key down the chain: class Base:     """Base Class for SQLAlchemy ORM Classes"""     @declared_attr     def __tablename__(cls):     """Default the Table Name to the Class Name"""     return cls.__name__

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Mike Bayer
there's an FAQ entry, a little bit dated but the general idea is still there, at: https://docs.sqlalchemy.org/en/13/faq/ormconfiguration.html#i-m-getting-a-warning-or-error-about-implicitly-combining-column-x-under-attribute-y for joined table inheritance, where Name(Node) -> node_id are FK -> P

[sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Richard Damon
I am getting the following error: SAWarning: Implicitly combining column Node.node_id with column Name.node_id under attribute 'node_id'.  Please configure one or more attributes for these same-named columns explicitly. In my case I am using poymorphic classes by joining with the ORM. Node is the