[sqlalchemy] Manage Session

2009-06-04 Thread Ghido
Hi all, i have a problem on manage the sessions. I whish to insert 2 object on my database: obj1 = machine() obj2 = action() i want to insert one machine and reuse the id of the machine for insert the action, this part is ok: config.Sess.add(obj1) config.Sess.commit() return

[sqlalchemy] Re: Query - column names

2009-06-04 Thread King Simon-NFHD78
George Sakkis wrote: Is there a (public) API for getting the column names of a given Query instance and other similar introspection needs ? I didn't find anything related in the docs but after digging in the code I came up with col_names = [e._result_label for e in q._entities] but

[sqlalchemy] Re: SqlAlchemy reflection error in TurboGears 2

2009-06-04 Thread Mike Driscoll
Well, I did the fake id column because SA was throwing an error on a the reflected table since it didn't have a primary key defined. I think I may have found a workaround though. Thanks for the help. Mike On Jun 3, 5:05 pm, Michael Bayer mike...@zzzcomputing.com wrote: i don't see what the

[sqlalchemy] select and join functions

2009-06-04 Thread santhoshkumar.subram...@gmail.com
I have two tables tags and deal_tag, and table definition follows, Table('tags', metadata, Column('id', types.Integer(), Sequence('tag_uid_seq'), primary_key=True), Column('name', types.String()), ) Table('deal_tag', metadata, Column('dealid',

[sqlalchemy] Re: MySQL has gone away (again)

2009-06-04 Thread Michael Bayer
the connection went from good to dead within a few seconds (assuming SQL was successfully emitted on the previous checkout). Your database was restarted or a network failure occurred. Kamil Gorlo wrote: Hi, I know this problem shows on group from time to time, but suggested solutions

[sqlalchemy] Re: SqlAlchemy reflection error in TurboGears 2

2009-06-04 Thread Mike Driscoll
Hi Simon and Michael, On Jun 4, 8:03 am, King Simon-NFHD78 simon.k...@motorola.com wrote: Mike Driscoll wrote: Well, I did the fake id column because SA was throwing an error on a the reflected table since it didn't have a primary key defined. I think I may have found a workaround

[sqlalchemy] Re: Query - column names

2009-06-04 Thread George Sakkis
Thanks, didn't know that, though in this case I want the keys in the same column order but keys() doesn't preserve it. George On Jun 3, 8:59 pm, Michael Bayer mike...@zzzcomputing.com wrote: each row has a keys() attribute if that helps... On Jun 3, 2009, at 8:49 PM, George Sakkis wrote:

[sqlalchemy] Re: Query - column names

2009-06-04 Thread George Sakkis
On Jun 4, 5:09 am, King Simon-NFHD78 simon.k...@motorola.com wrote: George Sakkis wrote: Is there a (public) API for getting the column names of a given Query instance and other similar introspection needs  ? I didn't find anything related in the docs but after digging in the code I came

[sqlalchemy] Re: Creating a Dialect for Amazon SimpleDB

2009-06-04 Thread az
sorry to tune in late, but how different is AmazonDB from googleDB? googleDB seems like a plain non-relational DB like berkeleyDB/btrieve kind of thing. to map a relational and non-relational schemas in same way u need higher level of abstraction - sqlalchemy is only about sql. so i had an

[sqlalchemy] Re: select and join functions

2009-06-04 Thread Bastian
You supplied the join() as a the whereclouse (2nd) parameter to the select method. This should work: select([tags_table.c.name,tags_table.c.id, func.count (deal_tags_table.c.dealid).label('dealcount')], from_obj=join(tags_table, deal_tags_table),group_by=[deal_tags_table.c.dealid]) Regards