[sqlalchemy] getting the actual sql used for a session.execute(sql,subs)

2010-02-11 Thread Chris Withers
Hi All, How can I get the actual sql executed by a: session.execute(sql,subs) ? I tried turning on echo in the engine, but that just shows %s where the substitutions should happen. Is there any way to get the post-substitution sql? (so that you can spot bugs where there have been typos in

[sqlalchemy] Re: Collation and Column()

2010-02-11 Thread Christoph Burgmer
Thanks for your quick answer, On Feb 11, 1:32 am, Michael Bayer mike...@zzzcomputing.com wrote: if SQLite supports a COLLATE syntax, then sure we can accept patches for 0.6 /trunk. If you want instant gratification on sqlite just build yourself a UserDefinedType for now (again 0.6/trunk).

[sqlalchemy] Re: How to order_by relation by another join?

2010-02-11 Thread Andrija Zarić
Thanks, Mike! Your example indeed works, but unfortunately when I add inheritance, mapper fails to generate proper (inherited) class: (I've changed code a little, so it represents more what I'm trying to do) from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative

Re: [sqlalchemy] Re: Collation and Column()

2010-02-11 Thread Michael Bayer
On Feb 11, 2010, at 6:33 AM, Christoph Burgmer wrote: Thanks for your quick answer, On Feb 11, 1:32 am, Michael Bayer mike...@zzzcomputing.com wrote: if SQLite supports a COLLATE syntax, then sure we can accept patches for 0.6 /trunk. If you want instant gratification on sqlite just

Re: [sqlalchemy] Re: How to order_by relation by another join?

2010-02-11 Thread Michael Bayer
On Feb 11, 2010, at 6:45 AM, Andrija Zarić wrote: Thanks, Mike! Your example indeed works, but unfortunately when I add inheritance, mapper fails to generate proper (inherited) class: (I've changed code a little, so it represents more what I'm trying to do) class ValueItem(Item):

Re: [sqlalchemy] Re: How to order_by relation by another join?

2010-02-11 Thread Andrija Zarić
On 11 February 2010 14:26, Michael Bayer mike...@zzzcomputing.com wrote: I'm assuming these are single-table inheritance mappers (I forgot about that add the column trick..) So yeah my solution was a quick hack and to continue in this way you'd have to build non-primary mappers for each of

[sqlalchemy] Re: Collation and Column()

2010-02-11 Thread Christoph Burgmer
On Feb 11, 2:20 pm, Michael Bayer mike...@zzzcomputing.com wrote: 0.4.8 you'd subclass TypeEngine. I don't think theres too much surprising going on there with types, plus sqlite accepts only unicode strings these days anyway so that's sort of handled too. Thanks, that looks promising.

[sqlalchemy] declaring relations on both sides of a join

2010-02-11 Thread Chris Withers
Hi All, Is this the right way to do this: class Blog(Base): __tablename__='blog_entry' id = Column(Integer, primary_key=True) date = Column('dated', Date, nullable=False) title = Column(String(80)) entry = Column(Text()) owners_name =

Re: [sqlalchemy] getting the actual sql used for a session.execute(sql,subs)

2010-02-11 Thread Wichert Akkerman
On 2010-2-11 12:13, Chris Withers wrote: Hi All, How can I get the actual sql executed by a: session.execute(sql,subs) ? I tried turning on echo in the engine, but that just shows %s where the substitutions should happen. Is there any way to get the post-substitution sql? SQLAlchemy does

Re: [sqlalchemy] declaring relations on both sides of a join

2010-02-11 Thread Michael Bayer
Chris Withers wrote: Hi All, Is this the right way to do this: class Blog(Base): __tablename__='blog_entry' id = Column(Integer, primary_key=True) date = Column('dated', Date, nullable=False) title = Column(String(80)) entry = Column(Text()) owners_name

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Jeff Peterson
-- Jeffrey D Peterson Webmaster Crary Industries, Inc. From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: Wednesday, February 10, 2010 6:30 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Warnings take a really long time /

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Michael Bayer
that SQL output is specific to 'table_name': 'CFA_CASH_FLOW_STATUS_TAB' and 'table_name': 'CFA_CASH_FLOW_TAB'. that's two tables. Jeff Peterson wrote: -- Jeffrey D Peterson Webmaster Crary Industries, Inc. From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Jeff Peterson
Right, and there is that same code outputted for every table in the schema, when reflecting that one view. What I posted was just the one snippet, it is repeated over and over for each different table. -- Jeffrey D Peterson Webmaster Crary Industries, Inc. -Original Message- From:

[sqlalchemy] obtaining pid of forked process

2010-02-11 Thread Faheem Mitha
Hi, sqlalchemy forks a process when it calls the db (in my case PostgreSQL, but I don't think it matters) using, for example from sqlalchemy.sql import text s = text(...) My question - is it possible to obtain the pid of this process at the python level in some fashion? The reason for this

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Michael Bayer
I thought you were reflecting a view ? a table will fan out to all of its constraints, yes. Jeff Peterson wrote: Right, and there is that same code outputted for every table in the schema, when reflecting that one view. What I posted was just the one snippet, it is repeated over and over

Re: [sqlalchemy] obtaining pid of forked process

2010-02-11 Thread Michael Bayer
Faheem Mitha wrote: Hi, sqlalchemy forks a process when it calls the db (in my case PostgreSQL, but I don't think it matters) using, for example from sqlalchemy.sql import text s = text(...) um, what ? there's no forking in SQLAlchemy. My question - is it possible to obtain the

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Jeff Peterson
That is the troubling part, I am reflecting a view, and yet it is still touching all those tables in the DB for schema='CRAR1APP' -- Jeffrey D Peterson Webmaster Crary Industries, Inc. -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Michael Bayer
Jeff Peterson wrote: That is the troubling part, I am reflecting a view, and yet it is still touching all those tables in the DB for schema='CRAR1APP' does the name of your view appear at all in ALL_CONS_COLUMNS.TABLE_NAME ? that's the only way reflection of a view could get the name of a

[sqlalchemy] how to set up a simple two-phase commit?

2010-02-11 Thread PaulE
All, I want to do a two-phase commit. Published examples are more complex than what I need. To put it another way, I don't want to use the ORM. Here is what I want to do: # This code does what I want - but is missing the two-phase commit. # All session code is commented out because I am

Re: [sqlalchemy] how to set up a simple two-phase commit?

2010-02-11 Thread Michael Bayer
PaulE wrote: All, I want to do a two-phase commit. Published examples are more complex than what I need. To put it another way, I don't want to use the ORM. Here is what I want to do: A similar thread

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Jeff Peterson
The view name itself isn't but the names of all the tables that make up that view are. So I guess that must be why. -- Jeffrey D Peterson Webmaster Crary Industries, Inc. -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Michael Bayer
Jeff Peterson wrote: The view name itself isn't but the names of all the tables that make up that view are. So I guess that must be why. It is only looking at the columns declared in your view - the Table reflection logic doesn't actually look at the original definition of the view (there is a

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-11 Thread Jeff Peterson
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: Thursday, February 11, 2010 1:26 PM To: sqlalchemy@googlegroups.com Subject: RE: [sqlalchemy] Warnings take a really long time / NotImplementedError Jeff

[sqlalchemy] Automatic prefix on all tables

2010-02-11 Thread F. Poirotte
Hi, First, many thanks to everyone who helped make SQLAlchemy such a great module. I'm currently using the declarative syntax and I would like to know weither it's possible or not to automatically add a prefix on all tables, without having to specify it on each and every table separately. That

Re: [sqlalchemy] Automatic prefix on all tables

2010-02-11 Thread Michael Bayer
F. Poirotte wrote: Hi, First, many thanks to everyone who helped make SQLAlchemy such a great module. I'm currently using the declarative syntax and I would like to know weither it's possible or not to automatically add a prefix on all tables, without having to specify it on each and every

Re: [sqlalchemy] pyodbc - sqlserver in mac os x

2010-02-11 Thread Ed Singleton
I wrote a (long) blog post on this for Leopard. I haven't had the chance to try it out on Snow Leopard. http://blog.singletoned.net/2009/07/connecting-to-ms-sql-server-from-python-on-mac-os-x-leopard/ If anyone can tell me how to create virtual machines of Snow Leopard, I'd be happy to try

[sqlalchemy] Insert from Select Implentation

2010-02-11 Thread Ed Singleton
I've been having a clumsy hack at enabling myself to pass a select statement as a value to an insert statement. IE: sa.insert(mytable).values(myothertable.select()) I've got it working in that most basic case, but I'm struggling when the select statement has bindparams. The insert needs