[sqlalchemy] Re: alias not used with relationship to arbitary select

2007-03-22 Thread HD Mail
Sorry I forgot to add this mapper status_mapper = mapper(TaskStatus, task_status, order_by=task_status.c.seq_no ) > Hi, > > Sorry for the long email, below is a dump of the SA generated sql. > I have a relationship in one of my mappers to an abitrary select > (task_status). > My mapper also

[sqlalchemy] alias not used with relationship to arbitary select

2007-03-22 Thread HD Mail
Hi, Sorry for the long email, below is a dump of the SA generated sql. I have a relationship in one of my mappers to an abitrary select (task_status). My mapper also orders the result by a column in this abitrary select. I am using the latest SA from trunk. This use to work in an earlier versio

[sqlalchemy] Help with saving mapped objects to pylons session

2007-03-22 Thread HD Mail
Hi, I am having problems with saving/restoring mapped objects from a pylons session. I am getting the "no attribute" on a list attribute (which is a one-many relationship) error when pylons tries to unpickle the object. I've read a previous post where Michael explains why this happens. I have

[sqlalchemy] Re: [patch] two-phase commit support for PostgreSQL

2007-03-22 Thread Benno Rice
On 23/03/2007, at 3:40 AM, Michael Bayer wrote: > > OK, I like a lot of this patch. I know im being a pain in the ass > about these patches, and for that I apologize; they are of high > quality and theyre clear in their operation/intention etc. That's cool. I'm fairly new to the SQLAlchemy cod

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Michael Bayer
its been the documented/expected behavior since the beginning that subqueries which feature the same table as the enclosing query are automatically correlated. the original idea was that if you wanted a subquery to use the same table without correlation, youd use an alias of that table.

[sqlalchemy] Re: how to display all the tables of my DB

2007-03-22 Thread Mando
I launched it, but I receive this error message: Traceback (most recent call last): File "autocode.py", line 20, in tbl = Table(tname, metadata, schema=schema, autoload=True); File "build/bdist.macosx-10.3-fat/egg/sqlalchemy/schema.py", line 143, in __call__ File "build/bdist.macosx-10

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Paul Johnston
Hi, >clearly "correlate=False" has to be more prominently mentioned, not >just in the FAQ but in the main docs, there should be a section >specifically on subqueries and their mechanics. > > Could SQLAlchemy deal with this case automatically? I think it could. Subqueries that are used in a

[sqlalchemy] Re: Fix on ADODBAPI

2007-03-22 Thread Paul Johnston
Hi, That doesn't work for me - it makes create_engine() hang for ages then fail. I wonder if this is because without a port, the driver first tries a named pipe connection. If you are keen to include this functionality, you'll have to do a bit more ground work. The other issue you mention, wi

[sqlalchemy] Re: Object-oriented engine?

2007-03-22 Thread Michael Bayer
or schevo. On Mar 22, 2007, at 8:12 AM, Kevin Dangoor wrote: > check out the ZODB if you haven't already and want a pure OO database. > > On Feb 8, 2007, at 3:43 PM, chmod wrote: > >> >> Has anyone tried making an engine for an OODB? My company is heavily >> ties into Versant, and we'd love to us

[sqlalchemy] Re: [patch] two-phase commit support for PostgreSQL

2007-03-22 Thread Michael Bayer
OK, I like a lot of this patch. I know im being a pain in the ass about these patches, and for that I apologize; they are of high quality and theyre clear in their operation/intention etc. so, heres my take on it. since most DBAPIs do not support PREPARE TRANSACTION, I dont like having th

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Koen Bok
It worked! Thanks a bunch! On Mar 22, 5:06 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > clearly "correlate=False" has to be more prominently mentioned, not > just in the FAQ but in the main docs, there should be a section > specifically on subqueries and their mechanics. > > On Mar 22, 2007

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Michael Bayer
clearly "correlate=False" has to be more prominently mentioned, not just in the FAQ but in the main docs, there should be a section specifically on subqueries and their mechanics. On Mar 22, 2007, at 6:53 AM, King Simon-NFHD78 wrote: > > This caught me out a couple of weeks ago, and I've see

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Michael Bayer
put "correlate=False" on your subquery. On Mar 22, 2007, at 6:42 AM, Koen Bok wrote: > > Thanks for the reply! If the performance is about equal, that's fine! > > But I think I might have found a bug. > > When I make a selection it generates the following (faulty) SQL query: > > SELECT > s

[sqlalchemy] Custom row information

2007-03-22 Thread Mathieu Rouleau
Hi, quick question Lets say table A has a column 'score' and I want to sort all entries in A by 'score', what I'd like is to have a rank (index) associated to each row returned. So that finally I can subselect an individual row and know its relative score rank within the table. Its something I k

[sqlalchemy] Re: Object-oriented engine?

2007-03-22 Thread Kevin Dangoor
check out the ZODB if you haven't already and want a pure OO database. On Feb 8, 2007, at 3:43 PM, chmod wrote: > > Has anyone tried making an engine for an OODB? My company is heavily > ties into Versant, and we'd love to use SQLAlchemy if possible. Is > this even a valid thought? Versant doesn'

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread King Simon-NFHD78
This caught me out a couple of weeks ago, and I've seen a couple of other similar questions as well. You need to add 'correlate=False' to the nested select. I wonder if this should be added to the FAQ? Hope that helps, Simon -Original Message- From: sqlalchemy@googlegroups.com [mailto:

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Koen Bok
Let me post some sample code with that: mapper(Request, request_table, properties={ 'children' : relation( Request, primaryjoin=request_table.c.id_parent==request_table.c.id, backref=backref("parent", remote

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread Koen Bok
Thanks for the reply! If the performance is about equal, that's fine! But I think I might have found a bug. When I make a selection it generates the following (faulty) SQL query: SELECT stock_request.id_stocktype AS stock_request_id_stocktype, stock_request.unordered AS stock_re