[sqlalchemy] incoherent behavior between oracle and postgres on engine.rowcount

2009-01-24 Thread Jose Soares
Hi all, I wonder why there's such difference between oracle and pg: oracle: (Pdb) engine.connect().execute(sql).fetchone() select * from ruolo_permesso where cod_ruolo = 'SYSADMIN' and cod_permesso='TIPO_FIGURA' and inserimento='1' None (1273, 'SYSADMIN', 'TIPO_FIGURA', 1, 1, 1, 1) (Pdb)

[sqlalchemy] Re: Full connection pool close

2009-01-24 Thread Smoke
On 23 Gen, 23:43, Rick Morrison rickmorri...@gmail.com wrote: From your earlier post: a_session.close() sa_Session.close_all() sa_engine.dispose()       del sa_engine but it does not close the connection! Here's Engine.dispose (line 1152, engine/base.py)     def

[sqlalchemy] Re: incoherent behavior between oracle and postgres on engine.rowcount

2009-01-24 Thread Michael Bayer
rowcount is pulled directly from the DBAPI cursor and is usually only reliable for an UPDATE or DELETE statement.Feel free to consult on the cx_oracle mailing list for why it might return 0 for a one-row SELECT statement - my guess would be that no rows were fetched from the server.

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-24 Thread Brett
I drastically sped up my inserts by precomputing any defaults on a column and passing them explicitly instead of calculating them on each insert. For example, each row had a timestamp and the timestamp was being calculated on each insert for each row. Since I was inserting them all at the same

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-24 Thread Brett
See it here on lines 323-352: http://bazaar.launchpad.net/~bauble/bauble/trunk/annotate/head%3A/bauble/plugins/imex/csv_.py --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group,

[sqlalchemy] SQLAlchemy 0.5.2 released

2009-01-24 Thread Michael Bayer
This release fixes a few bugs, some preexisting, some introduced in 0.5.0, and one introduced in 0.5.1.Upgrading is recommended if you were affected by any of the bugs mentioned below. There is also a refinement to the delete-orphan on many-to-many/many- to-one policy, which will make

[sqlalchemy] Re: Full connection pool close

2009-01-24 Thread Rick Morrison
Hey, seems that you've got the problem. conn = self._pool.get( False ) is the problem It raises an Empty error...: It's supposed to; that's the exit condition for the while True loop. It does make it at least once through the loop, though right? Enough to close any connections you may

[sqlalchemy] unions and order_by

2009-01-24 Thread Brett
The script below is giving me the following error: sqlalchemy.exc.OperationalError: (OperationalError) ORDER BY clause should come after UNION not before u'SELECT anything.id, anything.any, anything.something_id \nFROM anything JOIN something ON something.id = anything.something_id ORDER BY any

[sqlalchemy] Re: Full connection pool close

2009-01-24 Thread Smoke
On 24 Gen, 21:27, Rick Morrison rickmorri...@gmail.com wrote: Hey, seems that you've got the problem. conn = self._pool.get( False ) is the problem It raises an Empty error...: It's supposed to; that's the exit condition for the while True loop.  It does make it at least once

[sqlalchemy] Re: Full connection pool close

2009-01-24 Thread Rick Morrison
Oh... i didn't explain myself... I mean that it's already empty at the first cycle of the loop... It would be normal to not enter the loop if you haven't yet opened any connections, as connections are opened on demand. Make sure your program issues at least one query during this test. If you

[sqlalchemy] Re: unions and order_by

2009-01-24 Thread Michael Bayer
you shouldnt be using order_by on your mapper(). thats a really old option in any case.if you need it to be there, say query.order_by(None).statement to cancel the order_by in each separate part of the union. however it would be even easier if you just said query.union(q1, q2) here

[sqlalchemy] Re: unions and order_by

2009-01-24 Thread Michael Bayer
youre going to want to set order_by like this too instead of the string 'any' class Anything(Base): __tablename__ = 'anything' id = Column(Integer, primary_key=True) any = Column(String) something_id = Column(Integer, ForeignKey('something.id')) somethings =

[sqlalchemy] Equivalent of UPDATE ... WHERE ... in ORM?

2009-01-24 Thread James
Hi, Is there a way to update a large number of objects without looping through each one, using SA's ORM? E.g. I want to achieve the following: for o in session.query(MyClass).filter_by(prop='some value'): o.prop = 'new value' session.update(o) Without fetching and saving each object

[sqlalchemy] Re: Equivalent of UPDATE ... WHERE ... in ORM?

2009-01-24 Thread Michael Bayer
the update() method on Query accomplishes this. Make sure you read the docstring for it which describes some various behaviors you'll want to be aware of. alternatively, any SQL expression, like table.update(), UPDATE table can be issued within the ORM's transaction using