[sqlalchemy] Re: Data types from a calculated column

2009-07-06 Thread Pongetti
Ah, after days of trying to figure it out, it turns out Postgres just won't let you cast a column when editing an existing view. I had to drop the view first and create a brand new one from scratch. Casting in SQLAlchemy worked but I think I'm going to go with the backend fix. Thanks for the

[sqlalchemy] Re: ordering list: list order not updated on delete (orm)

2009-07-06 Thread wobsta
On 4 Jul., 17:05, Michael Bayer mike...@zzzcomputing.com wrote: remove the item using remove().  What's the items must be in a list   rule, the not nullable foreign key ?  thats what delete-orphan   cascade is for, its in the tutorial and reference documentation. Thanks, this works for the

[sqlalchemy] queries with ORM

2009-07-06 Thread Julien Cigar
Hello, Any idea with the following query : Session.query(Folder, Data). select_from(folder.join(content).outerjoin(data.select().alias('foo'))) why SQLAlchemy generates : SELECT ... FROM data, folder JOIN content ON content.id = folder.content_id LEFT OUTER JOIN (SELECT data.content_id AS

[sqlalchemy] Re: ordering list: list order not updated on delete (orm)

2009-07-06 Thread Michael Bayer
wobsta wrote: On 4 Jul., 17:05, Michael Bayer mike...@zzzcomputing.com wrote: remove the item using remove().  What's the items must be in a list   rule, the not nullable foreign key ?  thats what delete-orphan   cascade is for, its in the tutorial and reference documentation. Thanks, this

[sqlalchemy] Re: queries with ORM

2009-07-06 Thread Julien Cigar
OK ... I found orm.aliased() which seems to do what I want to do, I have the following : images = File.query().join(Mime).join(MimeMajor)\ .filter_by(major='image').subquery() mapped_image = orm.aliased(File, images) q = Session.query(Content).with_polymorphic([Folder, mapped_image])

[sqlalchemy] relationship between multiple tables in single table

2009-07-06 Thread rajasekhar911
I have 4 tables tbl1, tbl2, tbl3 tbl4. There are OTM MTM (parent-child , friend ...) relations between these tables. Right now each relation has its own MTM table. like tbl1_tbl2, tbl1_tbl3, tbl2_tbl3, tbl3_tbl4, tbl2_tbl4. Is there a way to put all these relations into single table called