[sqlalchemy] Re: composite primary key/postgres

2008-05-13 Thread Eric Ongerth
So part of the problem is postgresql is autoincrementing where you do not want it to do so? I thought postgresql only autoincrements where your column is of type 'serial'. Is that not true? Or if so, you could use type 'integer' instead of 'serial'. There is also the possibility that the

[sqlalchemy] Re: Multiple SQLAlchemy DB usage in TurboGears

2008-05-13 Thread Bryn Divey
Michael: Thanks, I've gone the per-request route for the moment. The reason we're behind on SQLA versions is that the TurboGears we started on a year ago used that particular version; we do have TurboGears upgrade plans in place, so that'll be sorted out soon enough. Barry: I've left the Visit

[sqlalchemy] View this page sqlalchemy Insert

2008-05-13 Thread Ahmad Hassan
Click on http://groups.google.com/group/sqlalchemy/web/sqlalchemy-insert - or copy paste it into your browser's address bar if that doesn't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group.

[sqlalchemy] SQL mass-delete

2008-05-13 Thread jean-philippe dutreve
I'd like to delete all Transactions contained in an account hierarchy without loading any transaction into memory, just DB work with the SQL DELETE request constructed by SA. The query that defines the transactions is: Session.query(Transaction).join(['entries','account','root'],

[sqlalchemy] Re: SQL mass-delete

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 9:08 AM, jean-philippe dutreve wrote: I'd like to delete all Transactions contained in an account hierarchy without loading any transaction into memory, just DB work with the SQL DELETE request constructed by SA. The query that defines the transactions is:

[sqlalchemy] Re: SQL mass-delete

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 11:03 AM, jean-philippe dutreve wrote: I've this error: ProgrammingError: (ProgrammingError) subquery in FROM must have an alias HINT: For example, FROM (SELECT ...) [AS] foo. 'DELETE FROM winancial_integ.acc_transactions WHERE EXISTS (SELECT 1 \nFROM (SELECT

[sqlalchemy] Case insensitive queries

2008-05-13 Thread GK
I've been digging around the archives, web and source code to figure case insensitive queries using SA, and am posting these notes: (a) for review and comment, and (b) to provide some possible hints for others who may follow For me, a big benefit of using SA is that it insulates me from database

[sqlalchemy] Re: SQL mass-delete

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 11:28 AM, jean-philippe dutreve wrote: Ok thanks. Transaction_id is defined twice, one from transaction table another from entries: yeah can you just use a select() for this, for now ? Query in 0.4 really wasnt designed to be resused as a subquery.

[sqlalchemy] Re: SQL mass-delete

2008-05-13 Thread jean-philippe dutreve
fine. thank you for your help. jean-philippe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send

[sqlalchemy] Re: Case insensitive queries

2008-05-13 Thread jason kirtland
GK wrote: I've been digging around the archives, web and source code to figure case insensitive queries using SA, and am posting these notes: (a) for review and comment, and (b) to provide some possible hints for others who may follow For me, a big benefit of using SA is that it insulates

[sqlalchemy] Re: Query filtering like isinstance()

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 4:53 PM, Yannick Gingras wrote: If I want to query on containers and on area, I can simply do q = Container.query().filter(...) but, if I receive a query on Item and a base class, say either Item, Container or Area, how can I filter() my query to receive only the

[sqlalchemy] Re: DB Error handling in SQLAlchemy

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 5:15 PM, Randall Nortman wrote: handling. I'm curious how SA handles this, especially transient errors where a retry is the right thing to do. For example, in several of my current sqlite apps (using bare DB-API), I get occasional locking errors (Database is locked),

[sqlalchemy] How to specify NOLOCK queries in SA

2008-05-13 Thread BruceC
Hi all. I'm running a Pylons App using SA, Elixir connecting to a SQL Server 2005 db via PYODBC. I'm getting a lot of database locks, the statements appear to be like this: SET FMTONLY ON select table1.id from table1 where 1=2 SET FMTONLY OFF I'm assuming that this is getting information about

[sqlalchemy] Re: How to specify NOLOCK queries in SA (mssql)

2008-05-13 Thread Michael Bayer
On May 13, 2008, at 9:46 PM, BruceC wrote: Hi all. I'm running a Pylons App using SA, Elixir connecting to a SQL Server 2005 db via PYODBC. I'm getting a lot of database locks, the statements appear to be like this: SET FMTONLY ON select table1.id from table1 where 1=2 SET FMTONLY OFF I

[sqlalchemy] Re: DB Error handling in SQLAlchemy

2008-05-13 Thread Michael Bayer
What I forgot to mention in all that, is that SQLA also supports SAVEPOINT very strongly. Using a SAVEPOINT-capable database opens up your choices for being able to flush(), hit an error, and then retry what you were doing, without a rollback of the overarching transaction needed. We