[sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-16 Thread phasma
session imported from Meta ? If use Meta.Session.execute it's returns RowProxy, which has no lastrowid parameter. On 16 сен, 02:59, Michael Bayer mike...@zzzcomputing.com wrote: no its not a column on a row, its on the ResultProxy: result = session.execute('...') id = result.lastrowid

Re: [sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-16 Thread Chris Withers
On 16/09/2010 11:49, phasma wrote: session imported from Meta ? If use Meta.Session.execute it's returns RowProxy, which has no lastrowid parameter. Try this: with meta.Session: result = meta.Session.execute(INSERT statement) print result.lastrowid cheers, Chris -- Simplistix -

Re: [sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-16 Thread Michael Bayer
On Sep 16, 2010, at 6:49 AM, phasma wrote: session imported from Meta ? If use Meta.Session.execute it's returns RowProxy, which has no lastrowid parameter. execute() does not return a RowProxy. All execute() methods return a ResultProxy which consists of metadata about a result as well as

[sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-16 Thread phasma
I've found a solution. meta.Session.execute returns RowProxy instead of ResultProxy. Example: query = meta.engine.text(INSERT [...] VALUES(:text, :text1)) result = query.execute(text=123, text1=123) print result.lastrowid On 16 сен, 16:18, Chris Withers ch...@simplistix.co.uk wrote: On

Re: [sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-16 Thread Michael Bayer
On Sep 16, 2010, at 11:15 AM, Michael Bayer wrote: On Sep 16, 2010, at 10:47 AM, Chris Withers wrote: On 16/09/2010 14:32, Michael Bayer wrote: session imported from Meta ? If use Meta.Session.execute it's returns RowProxy, which has no lastrowid parameter. execute() does not return

[sqlalchemy] Re: internationalization of content

2010-09-16 Thread NiL
Hello again, I published an updated version of acts_as_localized on http://code.google.com/p/elixirlocalized/ It is an Elixir's Entity builder that will manage several translations for DB contents If anyone cares to review or use it. NiL -- You received this message because you are

[sqlalchemy] sql.expression.text in clause how to?

2010-09-16 Thread Pykler
How can I use a list , tuple or any iterable in an in clause using the plain sql expression and bindparams. e.g. engine.execute(sql.expression.text(''' select * from users where id in :ids '''), ids=[1,2,3,4]) what do I need to change to make this work. I tried this, and it generates not sql:

[sqlalchemy] semantics of tometadata

2010-09-16 Thread Chris Withers
Hi All, As part of looking into #1919, I see that if a table of the same name as the one passed to tometadata already exists in the destination metadata, then the table object passed in is ignored and the one already there is returned. That feels wrong to me. In the event there's already a

Re: [sqlalchemy] semantics of tometadata

2010-09-16 Thread Michael Bayer
On Sep 16, 2010, at 2:56 PM, Chris Withers wrote: Hi All, As part of looking into #1919, I see that if a table of the same name as the one passed to tometadata already exists in the destination metadata, then the table object passed in is ignored and the one already there is returned.

Re: [sqlalchemy] semantics of tometadata

2010-09-16 Thread Chris Withers
On 16/09/2010 20:26, Michael Bayer wrote: As such, I'd expect an exception to be raised rather than the other table object being returned. What do people feel about this? Im fine with tometadata raising for 0.7. a warning for 0.6 perhaps. Cool, done for 0.6. Where should I make the

[sqlalchemy] Re: sql.expression.text in clause how to?

2010-09-16 Thread Pykler
It seems it is not possible to do this with bindparams, my workaround was as follows On Sep 16, 2:01 pm, Pykler hnass...@gmail.com wrote: engine.execute(sql.expression.text(''' select * from users where id in %s '''% SqlTuple([1,2,3,4])) Where SqlTuple is a tuple with a custom repr method to

Re: [sqlalchemy] Re: sql.expression.text in clause how to?

2010-09-16 Thread Conor
On 09/16/2010 04:28 PM, Pykler wrote: It seems it is not possible to do this with bindparams, my workaround was as follows On Sep 16, 2:01 pm, Pykler hnass...@gmail.com wrote: engine.execute(sql.expression.text(''' select * from users where id in %s '''% SqlTuple([1,2,3,4]))

[sqlalchemy] Re: PostgreSQL, cascading and non-nullable ForeignKeys

2010-09-16 Thread BenH
I had misunderstood the documentation on relationships and then tied myself in a knot, I thought that relationship() defined a strictly parent to child relationship and that all the other parameters were from the parents point of view. My runs and is a lot cleaner! Thank you for helping me, BEN