Dear all,
I'm using SA 0.6.7 on a RHEL 6 with Python 2.6 and PostgreSQL 8.4.7.
These are some table of my DB:
pdb_table = Table('pdb', metadata,
Column('id', types.Integer, primary_key=True),
Column('code', types.Unicode(4), nullable=False),
)
chain_table = Table('chain', metadata,
Column('id', types.Integer, primary_key=True),
Column('letter', types.Unicode(1), nullable=False),
Column('pdb_id', types.Integer, ForeignKey('pdb.id')),
)
metal_table = Table('metal', metadata,
Column('id', types.Integer, primary_key=True),
Column('number', types.Integer, nullable=False),
Column('name', types.Unicode(4), nullable=False),
Column('pdb_id', types.Integer, ForeignKey('pdb.id')),
)
mapper(Pdb, pdb_table)
mapper(Chain, chain_table,
properties={
'pdb': relationship(Pdb, backref='chain')
})
mapper(Metal, metal_table,
properties={
'pdb': relationship(Pdb, backref='metal'),
'chain': relationship(Chain, backref='metal'),
})
If I try to remove a pdb table row related with others from
pgAdminIII, I correctly receive the constraint error and the row isn't
removed.
Using the following code, SA remove all rows related with others
without error:
for code in open(pdblist):
pdb = Session.query(Pdb).filter(Pdb.code==code.strip()).all()
for p in pdb:
# Remove PDB
Session.delete(p)
Session.commit()
Where I wrong?
Thanks
--
-------------------------------------------------------------------
(o_
(o_ //\ Coltivate Linux che tanto Windows si pianta da solo.
(/)_ V_/_
+------------------------------------------------------------------+
| ENRICO MORELLI | email: [email protected] |
| * * * * | phone: +39 055 4574269 |
| University of Florence | fax : +39 055 4574253 |
| CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
+------------------------------------------------------------------+
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.