Re: [sqlalchemy] Unset order_by()

2010-06-17 Thread Andi Albrecht
It's not different at all. I've just noticed that on the one hand it *is* possible to use query.order_by(None) to remove any previously set ordering, but on the other hand that _no_select_modifiers() in sqlalchemy/orm/query.py checks for False (and not None). It would be clearer to me if either

[sqlalchemy] sqlite transaction rollback after pk clash not working?

2010-06-17 Thread Harry Percival
Hey all, I have some code that attempts to add a bunch of new entries to a table in a single commit, with some try/excepts designed to catch any primary key errors. if any errors occur, i want to be able to manually go through and re-attempt each line one by one to understand which ones fail and

Re: [sqlalchemy] alchemy-migrate with DeclarativeBase

2010-06-17 Thread Francisco Souza
Hi , [...] But do I do this? Part of the problem is that I don't know of a way to generate tables other than create_all() (or drop_all()) when using declarative syntax. Is there another way? Hi Shane :) When you bind your declarative base to a metadata, the metadata object has a

Re: [sqlalchemy] Unset order_by()

2010-06-17 Thread Michael Bayer
OK, it looks like we did add this at some point, though I could not find a unit test where I would expect. So I added one in the latest tip. Here it is: class OrderByTest(QueryTest, AssertsCompiledSQL): def test_cancel_order_by(self): s = create_session() q =

Re: [sqlalchemy] sqlite transaction rollback after pk clash not working?

2010-06-17 Thread Michael Bayer
On Jun 17, 2010, at 6:21 AM, Harry Percival wrote: Hey all, I have some code that attempts to add a bunch of new entries to a table in a single commit, with some try/excepts designed to catch any primary key errors. if any errors occur, i want to be able to manually go through and

Re: [sqlalchemy] Unset order_by()

2010-06-17 Thread Andi Albrecht
Adding these two lines to your test makes it fail: q.delete() eq_(s.query(User).count(), 0) Here's the complete test to see it in context again: class OrderByTest(QueryTest, AssertsCompiledSQL): def test_cancel_order_by(self): s = create_session() q =

Re: [sqlalchemy] Unset order_by()

2010-06-17 Thread Michael Bayer
On Jun 17, 2010, at 3:15 PM, Andi Albrecht wrote: Adding these two lines to your test makes it fail: it turns out there is a test for this, and also that passing None does not have the same effect as order_by() never being called in the first place - it suppresses the order_by setting on the

[sqlalchemy] Re: How to save a null value in a field of type REAL PostGreSQL.

2010-06-17 Thread Marcio
hi, anybody ever needed a REAL field mapping with SQLAlchemy e PostGreSQL, to provide an example. Thank you very much. --- On 14 jun, 20:43, Marcio brambilla.mar...@gmail.com wrote: Hello, I'm using Pylons, Sqlalchimy and PostgreSQL, and am having trouble to save a field with null value in a

[sqlalchemy] Troubleshooting 'too many clients already'

2010-06-17 Thread Gregg Lind
What built-in tools / techniques should I use when trying to troubleshoot the 'too many clients already' fatal error. 1. Connecting to PG locally, fwiw, 2. I have full privileges on the db My connections can come from at least: - create_engine I try to be careful to del engine after I'm done

Re: [sqlalchemy] Troubleshooting 'too many clients already'

2010-06-17 Thread Michael Bayer
On Jun 17, 2010, at 8:14 PM, Gregg Lind wrote: What built-in tools / techniques should I use when trying to troubleshoot the 'too many clients already' fatal error. 1. Connecting to PG locally, fwiw, 2. I have full privileges on the db My connections can come from at least: -

Re: [sqlalchemy] Unset order_by()

2010-06-17 Thread Andi Albrecht
With the latest revision removing a order_by that was previously set by a mapping works fine now! Thanks for having a look at this! Andi On Thu, Jun 17, 2010 at 9:56 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 17, 2010, at 3:15 PM, Andi Albrecht wrote: Adding these two lines to