[sqlalchemy] create_all() trows table already exist, is not there and is not created....

2010-04-12 Thread Martijn Moeling
Hi, I have a weird problem. (Mysql) When I do a create_all(), i get the error : File /Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/engine/base.py, line 931, in _handle_dbapi_exception raise exc.DBAPIError.instance(statement, parameters, e,

[sqlalchemy] 0.6 Beta 3: specifying bindparams in update()

2010-04-12 Thread Jeff Peck
I recently tried out 0.6 beta 3, and I noticed that the following construct is no longer allowed using the sql expression language: def update_foos(connection, foo_items): update = foo_table.update( foo_table.c.id == bindparam('id'), values = { 'column_1' :

[sqlalchemy] Relationship crossing multiple tables

2010-04-12 Thread Anders Langworthy
Hi all, I've been trying to get the grandchildren relationship working in the code below, but have just about run out of permutations to try. I couldn't get much out of the docs, and the archives turned up a few similar queries but none with an answer. Is this even possible? Is there a better

Re: [sqlalchemy] Re: Firebird and rowcount

2010-04-12 Thread Michael Bayer
nekto0n wrote: Wow. That was fast =) Thanks for the fix. I'm a bit confused with results on 0.6beta3. Timer showed significant speed boost and profiler (and breakpoint in _CursorFairy) didn't show attempts to get rowcount. Am I doing something wrong? 0.6 is faster overall but I checked the

Re: [sqlalchemy] create_all() trows table already exist, is not there and is not created....

2010-04-12 Thread Michael Bayer
Martijn Moeling wrote: Hi, I have a weird problem. (Mysql) When I do a create_all(), i get the error : File /Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/engine/base.py, line 931, in _handle_dbapi_exception raise exc.DBAPIError.instance(statement,

Re: [sqlalchemy] 0.6 Beta 3: specifying bindparams in update()

2010-04-12 Thread Michael Bayer
Jeff Peck wrote: I recently tried out 0.6 beta 3, and I noticed that the following construct is no longer allowed using the sql expression language: def update_foos(connection, foo_items): update = foo_table.update( foo_table.c.id == bindparam('id'), values = {

Re: [sqlalchemy] Relationship crossing multiple tables

2010-04-12 Thread Michael Bayer
Anders Langworthy wrote: Hi all, I've been trying to get the grandchildren relationship working in the code below, but have just about run out of permutations to try. I couldn't get much out of the docs, and the archives turned up a few similar queries but none with an answer. Is this even

Re: [sqlalchemy] 0.6 Beta 3: specifying bindparams in update()

2010-04-12 Thread Michael Bayer
Michael Bayer wrote: I will add further detail to the error message. the new message is: CompileError: bindparam() name 'x' is reserved for automatic usage in the VALUES or SET clause of this insert/update statement. Please use a name other than column name when using bindparam() with

[sqlalchemy] Re: 0.6 Beta 3: specifying bindparams in update()

2010-04-12 Thread jpeck
Michael - Thank you so much for the explanation. Rereading this error message now makes perfect sense and this is a really good change. Also - thanks for the explanation about implicit vs explicit bindparams. I am embarrassed to admit that I actually did not know this, and I use the expression

[sqlalchemy] Re: sqlalchemy 0.5.8 'NoneType' object has no attribute 'get' error

2010-04-12 Thread Az
Ah, sorry I think I solved my own problem. I was doing something silly where I was creating Student instances before mapping class. Following advice, I put the code creating Student instances after calling mapper(Student, students_table) and it worked out. Many thanks for trying to replicate the

[sqlalchemy] Surrogate keys, multiple sessions

2010-04-12 Thread Az
Hi there, I'm just trying to sort out some code implementation utilising SQLAlchemy that should store some output for a Monte-Carlo simulation I'm running. The simulation works thus: I have a dictionary of students, with their preferred projects and a Monte-Carlo simulation that takes said

[sqlalchemy] relation auto-correlation

2010-04-12 Thread patrick
Hi, I'm trying to use the secondary argument to create a relation that joins two tables through an intermediary. SQLAlchemy says that it can't figure out the correlation automatically. There are other relations and mappings going on here on these tables, but the base of this is as follows.

Re: [sqlalchemy] relation auto-correlation

2010-04-12 Thread Michael Bayer
patrick wrote: Hi, I'm trying to use the secondary argument to create a relation that joins two tables through an intermediary. SQLAlchemy says that it can't figure out the correlation automatically. There are other relations and mappings going on here on these tables, but the base of

Re: [sqlalchemy] Relationship crossing multiple tables

2010-04-12 Thread Anders Langworthy
On Mon, Apr 12, 2010 at 11:04 AM, Michael Bayer mike...@zzzcomputing.com wrote: Anders Langworthy wrote: Hi all, I've been trying to get the grandchildren relationship working in the code below, but have just about run out of permutations to try.  I couldn't get much out of the docs, and the

[sqlalchemy] SQLite Foreign Key Enforcement

2010-04-12 Thread NickPerkins
Apparently, new versions of SQLite will enforce Foreign Keys ( unlike previous versions ), but, for the sake of backwards-compatibility, you have to explicitly turn on foreign key enforcement by issuing: pragma foreign_keys=on;. http://www.sqlite.org/foreignkeys.html I am new to SQLAlchemy --

Re: [sqlalchemy] Re: Firebird and rowcount

2010-04-12 Thread Michael Bayer
On Apr 12, 2010, at 1:00 AM, nekto0n wrote: Wow. That was fast =) Thanks for the fix. I'm a bit confused with results on 0.6beta3. Timer showed significant speed boost and profiler (and breakpoint in _CursorFairy) didn't show attempts to get rowcount. Am I doing something wrong? OK,

Re: [sqlalchemy] SQLite Foreign Key Enforcement

2010-04-12 Thread Michael Bayer
On Apr 12, 2010, at 7:22 PM, NickPerkins wrote: Apparently, new versions of SQLite will enforce Foreign Keys ( unlike previous versions ), but, for the sake of backwards-compatibility, you have to explicitly turn on foreign key enforcement by issuing: pragma foreign_keys=on;.

[sqlalchemy] Re: SQLite Foreign Key Enforcement

2010-04-12 Thread NickPerkins
Thanks, I tried it...but could not get the desired result ( enforced FKs using SQLite ). Here is my test code: #!/usr/bin/env python import sqlalchemy from sqlalchemy.interfaces import PoolListener class MyListener(PoolListener): def connect(self, dbapi_con, con_record):