[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread Gary Bernhardt
Referential integrity isn't being violated here - SA is nulling the foreign key before deleting the row it points to. Try adding nullable=False to the declaration of attivita.cod_specie. That should make it fail in the way you expect, because SA will no longer be able to null the foreign key.

[sqlalchemy] Re: PostGreSQL Referential Integrity with composed primary key

2007-02-15 Thread Gary Bernhardt
The pr_PurchaseRequisition_has_CELLS_budget_has_CELLS_costCenter table is the one that's causing your problem. It has a foreign key to CELLS_budget_has_CELLS_costCenter.CELLS_budget_ID (and another to CELLS_costCenter_ID on the same table). Neither of those two columns are unique. If you add

[sqlalchemy] Re: PostGreSQL Referential Integrity with composed primary key

2007-02-15 Thread Gary Bernhardt
with ForeignKeyConstraint. Search for it at http://www.sqlalchemy.org/docs/metadata.myt. So there is no solution to get it running with this requirement in postgresql ? (except defining a new ID but I cannot change the schema) On 15 Feb., 21:03, Gary Bernhardt [EMAIL PROTECTED] wrote

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread Gary Bernhardt
On 2/13/07, vinjvinj [EMAIL PROTECTED] wrote: Found the answer: # a function to create primary key ids i = 0 def mydefault(): global i i += 1 return i This counter is going to start over every time you run your program. The second time you run it, it's going to start

[sqlalchemy] Re: Newbie question about select statement

2007-02-13 Thread Gary Bernhardt
The Working with Large Collections section in the advanced mapping docs is probably what you want: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_working On 2/13/07, Cristiano Paris [EMAIL PROTECTED] wrote: I everyone. I'm pretty new to SQLAlchemy and never done

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread Gary Bernhardt
On 2/13/07, vinjvinj [EMAIL PROTECTED] wrote: This counter is going to start over every time you run your program. The second time you run it, it's going to start creating IDs that already exist, You missed my first post, which stated: I most certainly did. My apologies. :) I use the