I forgot to state that all derived abstract orm classes (e.g
Source_orm_lvl0, Source_orm_lvlA) also need the class attribute
'__abstract__= True' set
> myproj_lvl0
> | - meta_def [metadata0 Metadata; source_table = Tables(...)]
> | - orm_def [from .meta_def import metadata, source_table;
> Base=declarative_base(metadata); class Source_orm_lvl0(Base):
> @declared_attr __table__ = source_table @declared_attr def _loc:
> relation('Location') ...]
> | - mapper_def [from .orm_def import Source_orm_lvl0; class
> Source(Source_orm_lvl0): pass]
> myproj_lvlA
> | - orm_def [from ..myproj_lvl0 import Source_orm_lvl0;
> Source_orm_lvlA(Source_orm_lvl0): @declared_attr def more: ...]
> | - mapper_def [from .orm_def import Source_orm_lvlA; class
> Source(Source_orm_lvlA): pass]
> myproj_lvlB
> ...(same structure as lvlB)
>
> scripts
> | - create_tables [from myproj_lvl0.meta_def import metadata;
> metadata.create_all(engine)]
> | - script_lvl0 [from .myproj_lvl0.mapper_def import Source, Location; s
> = session.merge(Source('ABC')); print(type(s._loc)) #
> myproj_lvl0.mapper_def.Location ]
> | - script_lvlA [from .myproj_lvlA.mapper_def import Source, Location; s
> = session.merge(Source('ABC')); print(type(s._loc)) #
> myproj_lvlA.mapper_def.Location]
> | - script_lvlB [from .myproj_lvlB.mapper_def import Source, Location; s
> = session.merge(Source('ABC')); print(type(s._loc)) #
> myproj_lvlB.mapper_def.Location]
>
> I hope that helps if somebody should encounter the same problem
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/bec18184-f9f8-425f-ad5d-ecf5c7238a51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.