[sqlalchemy] session issues in TG - automatic commits happening.

2007-06-22 Thread SamDonaldson
Ok, so let me explain the problem we're facing. I'm using turbogears with sqlalchemy. I run a custom query by supplying the SELECT string to the engine and then execute() that. It returns back a list of tuples. I'd like it to return a bunch of instances of A but I can't seem to find the api

[sqlalchemy] Re: session issues in TG - automatic commits happening.

2007-06-22 Thread Paul Johnston
Sam, Well, you can do MyClass.select(conditions) which returns instances. If you only want to return a selection of comments, I believe there is a hook to do that; check the docs. I can understand this may seem strange to you, it certainly did to me in the beginning, but as I built up experience

[sqlalchemy] Setting passive default on an existing Postgresql table

2007-06-22 Thread Gloria
Hi all, I have a Postgresql 8.2.4 table where more than one field auto- increments. It looks like I need Passive defaults. Can someone show me how to add passive defaults to an existing db schema, where autoload=True. The doc glosses over this, and I can't pin down the syntax. Thank you, Gloria

[sqlalchemy] Qualified column names in JOINs?

2007-06-22 Thread Christoph Haas
Dear list, I'm trying to join a table with itself. That works well. However since the column names are identical I had no luck accessing both the original and the joined information. I have aliased the tables already and run the join on the aliased names. But the column names are still not

[sqlalchemy] Re: fetchall, cx_Oracle and oracle LOBs

2007-06-22 Thread Michael Bayer
On Jun 21, 2007, at 8:04 PM, [EMAIL PROTECTED] wrote: Hello, Based on http://www.sqlalchemy.org/trac/ticket/435 and a perusal of the source it seems to me that the sqlalchemy fetchall method with cx_Oracle supports retrieving multiple rows of an Oracle table that has CLOBs or BLOBs. I

[sqlalchemy] Re: session issues in TG - automatic commits happening.

2007-06-22 Thread Michael Bayer
On Jun 22, 2007, at 4:52 AM, SamDonaldson wrote: Ok, so let me explain the problem we're facing. I'm using turbogears with sqlalchemy. I run a custom query by supplying the SELECT string to the engine and then execute() that. It returns back a list of tuples. I'd like it to return a

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Michael Bayer
On Jun 22, 2007, at 9:59 AM, Christoph Haas wrote: Dear list, I'm trying to join a table with itself. That works well. However since the column names are identical I had no luck accessing both the original and the joined information. I have aliased the tables already and run the join

[sqlalchemy] Re: Cascades on tables from different databases?

2007-06-22 Thread Michael Bayer
On Jun 22, 2007, at 11:37 AM, Inno wrote: Hi, I am trying to make deletes cascade from one table to another, but unfortunately the tables are in different databases. code metadata1 = BoundMetaData('mysql://host/db1') metadata2 = BoundMetaData('mysql://host/db2') jobs_table =

[sqlalchemy] Cascades on tables from different databases?

2007-06-22 Thread Inno
Hi, I am trying to make deletes cascade from one table to another, but unfortunately the tables are in different databases. code metadata1 = BoundMetaData('mysql://host/db1') metadata2 = BoundMetaData('mysql://host/db2') jobs_table = Table('jobs', metadata1, Column('jobid', Integer,

[sqlalchemy] Bug in selection from many-to-many relationship?

2007-06-22 Thread Hong Yuan
Hi, With SQLAlchemy 0.3.8, I wanted to select from a many-to-many relationship with ORM, and found that if the select condition contains fields in the relation table, the relation table will be duplicated in the select statement and thus leading to wrong results. In the following example, I am

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Christoph Haas
On Fri, Jun 22, 2007 at 11:50:51AM -0400, Michael Bayer wrote: On Jun 22, 2007, at 9:59 AM, Christoph Haas wrote: I'm trying to join a table with itself. That works well. However since the column names are identical I had no luck accessing both the original and the joined

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Christoph Haas
On Fri, Jun 22, 2007 at 04:40:58PM -, Michael Bayer wrote: On Jun 22, 12:12 pm, Christoph Haas [EMAIL PROTECTED] wrote: 2007-06-22 18:09:57,852 INFO sqlalchemy.engine.base.Engine.0x..6c SELECT records_a.id, records_a.domain_id, records_a.dhcpzone_id, records_a.name, records_a.type,

[sqlalchemy] Re: Bug in selection from many-to-many relationship?

2007-06-22 Thread Michael Bayer
On Jun 22, 12:11 pm, Hong Yuan [EMAIL PROTECTED] wrote: Hi, With SQLAlchemy 0.3.8, I wanted to select from a many-to-many relationship with ORM, and found that if the select condition contains fields in the relation table, the relation table will be duplicated in the select statement and

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Michael Bayer
On Jun 22, 12:12 pm, Christoph Haas [EMAIL PROTECTED] wrote: 2007-06-22 18:09:57,852 INFO sqlalchemy.engine.base.Engine.0x..6c SELECT records_a.id, records_a.domain_id, records_a.dhcpzone_id, records_a.name, records_a.type, records_a.content, records_a.ttl, records_a.prio,

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Christoph Haas
On Fri, Jun 22, 2007 at 07:22:05PM +0200, Christoph Haas wrote: On Fri, Jun 22, 2007 at 04:40:58PM -, Michael Bayer wrote: On Jun 22, 12:12 pm, Christoph Haas [EMAIL PROTECTED] wrote: 2007-06-22 18:09:57,852 INFO sqlalchemy.engine.base.Engine.0x..6c SELECT records_a.id,

[sqlalchemy] Re: Setting passive default on an existing Postgresql table

2007-06-22 Thread Gloria
Thank you for your response. I tried posting this before, but it failed. Hopefully it won't double-post. I still get a can't adapt 'UPDATE... error. Here is the table from my schema: CREATE SEQUENCE user_change_num_seq INCREMENT BY 1 MINVALUE 0 NO

[sqlalchemy] Re: help with IronPython

2007-06-22 Thread Paul Johnston
Hi, pyodbc, pymssql, and adodbapi each use binary modules, so they would require some (unknown amount of) conversion to work with IronPython. Actually, adodbapi is pure Python, although it does depend on the win32com binary module. I wrapped a module around the IPCE adaptor module to meet

[sqlalchemy] slow autoload with SqlServer Information Schema

2007-06-22 Thread d_henderson
The query to autoload foreign keys from the information schema views on MS SQL Server performs very poorly for large databases. I extracted the query from the log generate with metadata.engine.echo = True. I tested used both windows and cygwin versions of python 2.5, pyodbc 2.0.36, SQLAlchemy

[sqlalchemy] Re: Setting passive default on an existing Postgresql table

2007-06-22 Thread Michael Bayer
On Jun 22, 3:34 pm, Gloria [EMAIL PROTECTED] wrote: user_change_db_obj.update(user_change_db_obj.c.user_change_num==change_num).execute(user_name=cherrypy.session['username'],prev_change=head.user_change_num,change_type=self.chgDesc, dom_string=Handy.jsonize(self.onestep),

[sqlalchemy] sqlalchemy.engine.engine_descriptors() is broken

2007-06-22 Thread d_henderson
A call to sqlalchemy.engine.engine_descriptors() fails with this traceback: $ ./python test_sa1.py engine_descriptors(): Traceback (most recent call last): File test_sa1.py, line 62, in module print 'engine_descriptors():',sqlalchemy.engine.engine_descriptors() File

[sqlalchemy] Re: Qualified column names in JOINs?

2007-06-22 Thread Michael Bayer
the contents of the columns clause is configurable via the select() construct directly: result=select([records_a, records_ptr], records_a.c.type=='A', from_obj=[model.outerjoin(records_a, records_ptr, ( (records_a.c.inet==records_ptr.c.inet) (records_ptr.c.type=='PTR') ))],

[sqlalchemy] Re: sqlalchemy.engine.engine_descriptors() is broken

2007-06-22 Thread Michael Bayer
this is a very old and unused feature that I should probably remove in 0.4. On Jun 22, 4:27 pm, d_henderson [EMAIL PROTECTED] wrote: A call to sqlalchemy.engine.engine_descriptors() fails with this traceback: $ ./python test_sa1.py engine_descriptors(): Traceback (most recent call last):

[sqlalchemy] Re: Setting passive default on an existing Postgresql table

2007-06-22 Thread Gloria
This worked, thank you for the quick response. The support here is outstanding, which is why I switched from SQLObject. Gloria On Jun 22, 4:27 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 22, 3:34 pm, Gloria [EMAIL PROTECTED] wrote:

[sqlalchemy] Re: sqlalchemy.engine.engine_descriptors() is broken

2007-06-22 Thread Michael Bayer
On Jun 22, 5:18 pm, d_henderson [EMAIL PROTECTED] wrote: I like the idea of a call which enumerates available engines. It's certainly easy to see if the module is installed, but a bit more difficult to see if it is supported ... I think we need all the help we can get to discover and