On 4/15/15 2:44 PM, Richard Gerd Kuesters wrote:
well, i'm almost given up ... i'm using concrete now, but it seems that something isn't right.

the error:

    sqlalchemy.exc.ArgumentError: When configuring property
    'updated_by' on Mapper|ContainerInstance|pjoin, column
    'container_instance.fk_updated_by' is not represented in the
    mapper's table. Use the `column_property()` function to force this
    column to be mapped as a read-only attribute.

now, what makes me a little hopeless:

1. i have a base object (a simple object), that have some attributes that i want in ALL of my tables (created_at, updated_at, created_by, upated_by), which all of them are @declared_attr; 2. my base object is a declarative_base which uses the object above described as the "cls" parameter; 3. then, i inherit AbstractConcreteBase and my declarative object to the parent class, having all FKs in it as @declared_attr too;
4. from bla import *, exception.

ps: using ConcreteBase, the error is: "AttributeError: type object 'ContainerInstance' has no attribute '__mapper__'"

The pattern you're doing is not what Posgresql INHERITS is really intended for. PG's feature is intended for transparent sharding of data to different tablespaces, not to simulate OR-mapped class hierarchies. The keyword is mis-named in this regard. Concrete inh is in all cases a tough road to travel because it's difficult to relate things to a whole set of tables which each act as "the table" for a class.







On 04/15/2015 03:13 PM, Richard Gerd Kuesters wrote:
oh, right, concrete! abstract concrete can also do the trick?


On 04/15/2015 03:10 PM, Mike Bayer wrote:


On 4/15/15 1:59 PM, Richard Gerd Kuesters wrote:
oops, i forgot to comment out the fk to the parent table and now it doesn't work: "sqlalchemy.exc.NoForeignKeysError: Can't find any foreign key relationships between 'container_instance' and 'container_aggregation'."

well, it doesn't need it if it's inherited (both db and software level), right?
correct, you'd use a "concrete" setup here from a SQLA perspective.

--
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
default-signature
Atenciosamente,

*Richard Gerd Kuesters*
*Pollux Automation*
Tel.: (47) 3025-9019
[email protected] | www.pollux.com.br
<http://www.pollux.com.br/>
        


• Linhas de Montagem
• Inspeção e Testes
• Robótica
        • Identificação e Rastreabilidade
• Software para Manufatura


--
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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.

Reply via email to