Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
hello Mike! so ... ok, based on this link http://docs.sqlalchemy.org/en/latest/faq/ormconfiguration.html#i-m-getting-a-warning-or-error-about-implicitly-combining-column-x-under-attribute-y (yeah yeah, well, rtfm for me), I was able to make it work like this: code class

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
nevermind. i'm again victim of rtfm :) http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#postgresql-table-options great work on this, btw. it'll simplify my life *A LOT* :) best regards, richard. On 04/15/2015 10:10 AM, Richard Gerd Kuesters wrote: hello Mike! so ... ok, based

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
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),

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
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

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
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

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Mike Bayer
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

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Mike Bayer
On 4/15/15 1:07 PM, Richard Gerd Kuesters wrote: ok, now i have an issue. i don't know why, but sqlalchemy seems to issue the create table command of inherited postgresql tables before the base one in metadata.create_all(). commenting the inherited table, issuing create all, what do your

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
the table definitions are listed here: http://pastebin.com/RxS8Lzft i'm using polymorphic associations, but with inheritance (INHERITS) there's no need to do it (imho), so the fk column to the parent table (which is also the pk) can be overriden. using add_is_dependent_on did the trick. i

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
yup, i know (this pattern) it is not ideal; i was just testing the new features of sa 1.0 regarding postgres (since i'm actually hands-on). i should rewrite a whole part of my model (and listeners and extensions and so on), which are already working with polymorphism. i will change this

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Mike Bayer
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

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-14 Thread Richard Gerd Kuesters | Pollux Automation
sorry, i mean i couldn't test it earlier, when i first asked the question :) it was not another co-worker, lol. cheers, richard. On 04/13/2015 06:30 PM, Mike Bayer wrote: On 4/13/15 4:59 PM, Richard Gerd Kuesters | Pollux Automation wrote: well, this didn't work with upstream 1.0 - sorry, I

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-13 Thread Mike Bayer
On 4/13/15 4:59 PM, Richard Gerd Kuesters | Pollux Automation wrote: well, this didn't work with upstream 1.0 - sorry, I was in another project and couldn't test it myself. you're not doing the same thing this user was doing in any case... Traceback (most recent call last): File

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-13 Thread Richard Gerd Kuesters | Pollux Automation
well, this didn't work with upstream 1.0 - sorry, I was in another project and couldn't test it myself. Traceback (most recent call last): File database_test.py, line 46, in module from plx.db.core import * File ../src/plx/db/core.py, line 901, in module

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-25 Thread Richard Gerd Kuesters | Pollux
hell yeah! that's exactly what i was looking for :) is it in the 1.0.0b3 or upstream? best regards, richard. On 03/24/2015 08:49 PM, Michael Bayer wrote: are these two separate constraints? I just looked and it seems like they are distinct. I just added a fix to 1.0 because someone was

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Michael Bayer
Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: hi all! i'm dealing with a little problem here. i have a parent table and its two inheritances. there is a value that both children have and must be unique along either types. is there a way to move this column to the parent

[sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Richard Gerd Kuesters | Pollux
hi all! i'm dealing with a little problem here. i have a parent table and its two inheritances. there is a value that both children have and must be unique along either types. is there a way to move this column to the parent and use a constraint in the child? my implementation is postgres

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Michael Bayer
are these two separate constraints? I just looked and it seems like they are distinct. I just added a fix to 1.0 because someone was hacking around something similar to this. The easiest way to get these for the moment is just to create the UniqueConstraint outside of the class definition.

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Richard Gerd Kuesters | Pollux
thanks again, Mike! just a question: to make the constraint in the parent, shouldn't i move other columns that composes the constraint to the parent too? cheers, richard. On 03/24/2015 10:33 AM, Michael Bayer wrote: Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: hi all!