[sqlalchemy] Re: XX and YY are both of the same direction symbol 'ONETOMANY error

2009-04-09 Thread Adrian
I have exactly the same problem with 0.5.3. On one machine the mapping works fine with 0.5.2 on another with 0.5.3 I get the error you mentioned. On Apr 2, 3:36 pm, Andreas Jung li...@zopyx.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am getting the following error after

[sqlalchemy] Re: When to create new sessions?

2009-04-09 Thread Diez B. Roggisch
On Thursday 09 April 2009 05:14:36 Bobby Impollonia wrote: Now the decorator swallows exceptions silently. You have to reraise the exception after rolling back like Michael did. I believe the correct form is: Darn.. you're right of course :) Diez

[sqlalchemy] Re: 0.5.3 and mssql

2009-04-09 Thread mdoar
This is what's working for me with 0.5.3 raw_cs = SERVER=%s;DATABASE=%s;UID=%s;PWD=%s % (server, database, userid, password) connection_string = %s:///?odbc_connect=%s % (databasetype, urllib.quote_plus(raw_cs)) if databasetype in ['mssql']: connection_string +=

[sqlalchemy] Re: relation that works in .48 but fails in .53

2009-04-09 Thread Michael Bayer
Bobby Impollonia wrote: Is there a video or slides from that pycon talk available online? I see the overview on the pycon site (http://us.pycon.org/2009/tutorials/schedule/2PM4/) and it looks very interesting. I looked more at what you said about the parent id column taking precedence and

[sqlalchemy] Re: XX and YY are both of the same direction symbol 'ONETOMANY error

2009-04-09 Thread Michael Bayer
On Apr 2, 10:36 am, Andreas Jung li...@zopyx.com wrote: The related code is:     class Hierarchies(Base, AsDictMixin):         __tablename__ = 'hierarchies'         __table_args__ = ( { 'autoload' : True, })         __mapper_args__ = ({'extension' : HierachiesDeletionLogger()})        

[sqlalchemy] Re: 0.5.3 and mssql

2009-04-09 Thread Lukasz Szybalski
On Wed, Apr 8, 2009 at 11:36 PM, mdoar md...@pobox.com wrote: This is what's working for me with 0.5.3 raw_cs = SERVER=%s;DATABASE=%s;UID=%s;PWD=%s % (server, database, userid, password) connection_string = %s:///?odbc_connect=%s % (databasetype, urllib.quote_plus(raw_cs)) if databasetype

[sqlalchemy] Re: 0.5.3 and mssql

2009-04-09 Thread mdoar
On Apr 9, 8:20 am, Lukasz Szybalski szybal...@gmail.com wrote: On Wed, Apr 8, 2009 at 11:36 PM, mdoar md...@pobox.com wrote: This is what's working for me with 0.5.3 raw_cs = SERVER=%s;DATABASE=%s;UID=%s;PWD=%s % (server, database, userid, password) connection_string =

[sqlalchemy] Readonly performance

2009-04-09 Thread mdoar
I'm using declarative classes for a table with a few foreign keys to other tables. When I look at the SQL queries I see the query to get all the rows of the main table and then a few extra queries for each row's foreign keys; all as expected. However, it seems that since I am not modifying any of

[sqlalchemy] Re: Readonly performance

2009-04-09 Thread Michael Bayer
mdoar wrote: I'm using declarative classes for a table with a few foreign keys to other tables. When I look at the SQL queries I see the query to get all the rows of the main table and then a few extra queries for each row's foreign keys; all as expected. However, it seems that since I am

[sqlalchemy] Re: Readonly performance

2009-04-09 Thread mdoar
On Apr 9, 12:19 pm, Michael Bayer mike...@zzzcomputing.com wrote: mdoar wrote: I'm using declarative classes for a table with a few foreign keys to other tables. When I look at the SQL queries I see the query to get all the rows of the main table and then a few extra queries for each

[sqlalchemy] Re: relation that works in .48 but fails in .53

2009-04-09 Thread Michael Bayer
Bobby Impollonia wrote: Is there a video or slides from that pycon talk available online? I see the overview on the pycon site (http://us.pycon.org/2009/tutorials/schedule/2PM4/) and it looks very interesting. we haven't put anything on line as of yet. I also just remembered that the

[sqlalchemy] Re: Readonly performance

2009-04-09 Thread Michael Bayer
mdoar wrote: Makes sense. Since I'm using reflection and declarative, I have code like aTable = Table(tablename, Base.metadata, Column('dbid', primary_key=True), Column('state', index=True),

[sqlalchemy] PostgreSQL executemany and result.last_inserted_ids()

2009-04-09 Thread Roy Hyunjin Han
I'm trying to use SQLAlchemy's executemany syntax in PostgreSQL and get the last_inserted_ids(). What is the recommended way to get these last_inserted_ids()? I know that I can access the id attribute for each model instance but there are hundreds of inserted rows and I would rather retrieve

[sqlalchemy] Re: PostgreSQL executemany and result.last_inserted_ids()

2009-04-09 Thread Roy Hyunjin Han
Yay! I solved it. Thanks for making such a great module. result = meta.Session.execute(model.names_table.insert(postgres_returning=[model.names_table.c.id]), [{'name': x} for x in names]) result.fetchall() [(40,), (41,), (42,)] On Thu, Apr 9, 2009 at 6:05 PM, Roy Hyunjin Han

[sqlalchemy] Re: Readonly performance

2009-04-09 Thread mdoar
On Apr 9, 2:48 pm, Michael Bayer mike...@zzzcomputing.com wrote: mdoar wrote: Makes sense. Since I'm using reflection and declarative, I have code like                 aTable = Table(tablename, Base.metadata,                                Column('dbid', primary_key=True),          

[sqlalchemy] Re: PostgreSQL executemany and result.last_inserted_ids()

2009-04-09 Thread Michael Bayer
Roy Hyunjin Han wrote: I'm trying to use SQLAlchemy's executemany syntax in PostgreSQL and get the last_inserted_ids(). What is the recommended way to get these last_inserted_ids()? I know that I can access the id attribute for each model instance but there are hundreds of inserted rows

[sqlalchemy] Re: XX and YY are both of the same direction symbol 'ONETOMANY error

2009-04-09 Thread Michael Bayer
Adrian wrote: in my case it must be something different. The following code works perfectly fine in 0.5.2: mapper(Contact, CONTACTS) mapper(Atom, ATOMS, properties = { 'Contacts': relation(Contact, primaryjoin = Contact.atom_id==ATOMS.c.id,

[sqlalchemy] Re: PostgreSQL executemany and result.last_inserted_ids()

2009-04-09 Thread Michael Bayer
Roy Hyunjin Han wrote: Yay! I solved it. Thanks for making such a great module. result = meta.Session.execute(model.names_table.insert(postgres_returning=[model.names_table.c.id]), [{'name': x} for x in names]) result.fetchall() [(40,), (41,), (42,)] this is not going to work

[sqlalchemy] Re: Readonly performance

2009-04-09 Thread Michael Bayer
mdoar wrote: i think you mean to say here that foreign_keys=Defect.state.  if the foreign keys are on the other side, thats one to many. I do indeed have it set up as one to many and then I get the first instance. Does that change the solution? in that case SQLA doesn't have what it needs