[sqlalchemy] ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Ergo
ConcurrentModificationError: Deleted rowcount 0 does not match number of objects deleted... I create my schema from models using create_all() - now , the problem is i get this error only using mysql or mysql+oursql. It happens every time in one place of my code. But when i uses postgresql

[sqlalchemy] Find related classes

2010-08-21 Thread simon
Hi all, For a given declaratively mapped class in SA 0.6, how do I programmatically find out all other mapped classes forming a many-to- one or many-to-many relationship with it? I know I can ask a table object for all its foreign keys, but the information whether it forms a many-to-one or a

Re: [sqlalchemy] How do I set the transaction isolation level in SQLAlchemy for PostgreSQL?

2010-08-21 Thread Michael Bayer
On Aug 19, 2010, at 6:32 PM, Mahmoud Abdelkader wrote: NOTE: I originally posted this question to stack overflow, http://stackoverflow.com/questions/3518863/how-do-i-set-the-transaction-isolation-level-in-sqlalchemy-for-postgresql , but I haven't received an answer yet. If I find the answer

Re: [sqlalchemy] ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 7:45 AM, Ergo wrote: ConcurrentModificationError: Deleted rowcount 0 does not match number of objects deleted... for clarity, this error has been renamed to StaleDataError.Here is the docstring coming up in 0.6.4: * A flush may have attempted to update or delete

Re: [sqlalchemy] Find related classes

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 12:05 PM, simon wrote: Hi all, For a given declaratively mapped class in SA 0.6, how do I programmatically find out all other mapped classes forming a many-to- one or many-to-many relationship with it? I know I can ask a table object for all its foreign keys, but the

Re: [sqlalchemy] declarative base - can a relationship be used within a column_property?

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 1:38 PM, Michael Bayer wrote: On Aug 19, 2010, at 6:38 AM, Yap Sok Ann wrote: With declarative base, is it possible to use a relationship within a column_property? you mean, as I am seeing below, to use the any() operator produced by a relationship... Here's

[sqlalchemy] Re: ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Ergo
Hi, Sorry Michael i was unclear on this - i tested on 4 drivers: psycopg2, pg8000, mysql-python (1.2.3c1), oursql (0.9.2) mysql-connector (0.1.5) on pg drivers everything works fine, on both on them, every single mysql driver fails. the problem is solvable by passing passive_deletes=True, to

[sqlalchemy] Re: Find related classes

2010-08-21 Thread simon
That was exactly what I was looking for. Thanks a lot :-) Simon On 21 Aug., 19:57, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 21, 2010, at 12:05 PM, simon wrote: Hi all, For a given declaratively mapped class in SA 0.6, how do I programmatically find out all other mapped

[sqlalchemy] Adjacency List Relationships using declarative

2010-08-21 Thread Michael Hipp
I'm trying to do exactly what is described here: http://www.sqlalchemy.org/docs/mappers.html#adjacency-list-relationships But I'm using declarative. Here's what I have but it fails with the exception below: class Option(Base): __tablename__ = 'options' id_ = Column(Integer,

Re: [sqlalchemy] Re: ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 3:04 PM, Ergo wrote: Hi, Sorry Michael i was unclear on this - i tested on 4 drivers: psycopg2, pg8000, mysql-python (1.2.3c1), oursql (0.9.2) mysql-connector (0.1.5) on pg drivers everything works fine, on both on them, every single mysql driver fails. the

Re: [sqlalchemy] Adjacency List Relationships using declarative

2010-08-21 Thread Michael Hipp
On 8/21/2010 6:00 PM, Michael Bayer wrote: On Aug 21, 2010, at 5:16 PM, Michael Hipp wrote: How do I make this work with declarative? If you were to use string literals with remote_side here, its the full expression would be a string, i.e. remote_side=Option.id_. But that's not needed here

Re: [sqlalchemy] Adjacency List Relationships using declarative

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 7:20 PM, Michael Hipp wrote: On 8/21/2010 6:00 PM, Michael Bayer wrote: On Aug 21, 2010, at 5:16 PM, Michael Hipp wrote: How do I make this work with declarative? If you were to use string literals with remote_side here, its the full expression would be a string, i.e.

[sqlalchemy] Re: ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Ergo
yeah a friend suggested to me that it could have been about the fact i forgot to define innodb in model definitions, and unfortunately that didnt help anything. I guess ill set passive_deletes to True, but it would be still good to investigate further why this happens - since it seems a

Re: [sqlalchemy] Re: ConcurrentModificationError: Deleted rowcount 0 ... but only on mysql?

2010-08-21 Thread Michael Bayer
On Aug 21, 2010, at 7:43 PM, Ergo wrote: yeah a friend suggested to me that it could have been about the fact i forgot to define innodb in model definitions, and unfortunately that didnt help anything. I guess ill set passive_deletes to True, but it would be still good to investigate

[sqlalchemy] Re: declarative base - can a relationship be used within a column_property?

2010-08-21 Thread Yap Sok Ann
On Aug 22, 2:12 am, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 21, 2010, at 1:38 PM, Michael Bayer wrote: On Aug 19, 2010, at 6:38 AM, Yap Sok Ann wrote: With declarative base, is it possible to use a relationship within a column_property? you mean, as I am seeing below, to