Re: [sqlalchemy] Re: Unexpected Behavior for ondelete='CASCADE' in Postgres

2010-12-10 Thread Michael Bayer
you probably want to use passive_deletes=True as well so that collections aren't loaded in for unnecessary, individual DELETEs: http://www.sqlalchemy.org/docs/orm/collections.html#using-passive-deletes On Dec 10, 2010, at 7:27 PM, Matin Tamizi wrote: > Note to self: read docs better. > > I had

[sqlalchemy] Re: Unexpected Behavior for ondelete='CASCADE' in Postgres

2010-12-10 Thread Matin Tamizi
Note to self: read docs better. I had to add a cascade='delete' in the backref. I tried this the first time, but put it in the relationship instead of the backref. class Post(Base): __tablename__ = 'posts' id = Column(Integer, primary_key=True) title = Column(String(255), nullable=False) body = C

[sqlalchemy] Unexpected Behavior for ondelete='CASCADE' in Postgres

2010-12-10 Thread zende
Assuming I define my tables using the following: CREATE TABLE users ( id SERIAL NOT NULL, username VARCHAR(255) NOT NULL, PRIMARY KEY (id), UNIQUE (username) ) CREATE TABLE posts ( id SERIAL NOT NULL, title VARCHAR(255) NOT NULL, body TEXT NOT NULL, user_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(

Re: [sqlalchemy] Attach a string to each results of a query

2010-12-10 Thread Christian Démolis
Okay it works literal() and literal_column() functions works with sqlite but only literal() function works with MySQLdb connector Thanks a lot !) 2010/12/9 Michael Bayer > > On Dec 9, 2010, at 11:14 AM, Christian Démolis wrote: > > "Could not locate column in row for column '%s'" % key) > sqla