[sqlalchemy] updating of the query results

2011-09-09 Thread Eduardo
Dear all, I make a query to find the highest version of a document and then I want to set a flag to column actual to 1 (TRUE) to all entries satisfying the query. I dont want to loop through hits but to set this flag in a one stroke with update. However I get this error:

Re: [sqlalchemy] Make a copy of a select

2011-09-09 Thread Torsten Landschoff
On Tue, 2011-09-06 at 10:03 -0400, Michael Bayer wrote: the generative method on Select is select_from(): http://www.sqlalchemy.org/docs/core/expression_api.html?highlight=select_from#sqlalchemy.sql.expression.Select.select_from Thanks. The documentation on that methods says: return a new

Re: [sqlalchemy] Make a copy of a select

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 6:48 AM, Torsten Landschoff wrote: On Tue, 2011-09-06 at 10:03 -0400, Michael Bayer wrote: the generative method on Select is select_from(): http://www.sqlalchemy.org/docs/core/expression_api.html?highlight=select_from#sqlalchemy.sql.expression.Select.select_from

Re: [sqlalchemy] Seemingly inconsistent results with transaction isolation

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 12:57 AM, Russ wrote: I was getting some strange transaction isolation behavior with SQLAlchemy (0.7.2), psycopg2 (2.4.2), and PostgreSQL 8.4. In order to investigate I wrote up a usage sequence that does this: 1. starts a transaction with a session (s1) 2. starts

Re: [sqlalchemy] Seemingly inconsistent results with transaction isolation

2011-09-09 Thread Russ
Thanks for clarifying with a full answer! This should not be construed to mean that you should only use the ORM with SERIALIZABLE isolation. It's instead just something to be aware of. You can of course expire any object or individual attribute at any time. In this case, if you were to add

Re: [sqlalchemy] Re: PyODBCConnector, possible wrong assumption re Unicode in bind parameters

2011-09-09 Thread Michael Bayer
On Sep 8, 2011, at 9:37 AM, Victor Olex wrote: Meanwhile, I can tell you how to build the stack because it is a bit tricky given certain package issues. I chose to build unixODBC and FreeTDS and pyodbc from sources into /usr/local. Hi Victor - I've installed unixODBC 2.3 /freetds 0.91 on a

[sqlalchemy] Enh. request: more details on Unicode type warning

2011-09-09 Thread werner
Tracking down where one forgot to use u'' e.g.: somemodelinstance.somecol = 'somevalue' instead of: somemodelinstance.somecol = u'somevalue' is sometimes not that easy to track down as the warning doesn't provide any hints.

Re: [sqlalchemy] Enh. request: more details on Unicode type warning

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 11:01 AM, werner wrote: Tracking down where one forgot to use u'' e.g.: somemodelinstance.somecol = 'somevalue' instead of: somemodelinstance.somecol = u'somevalue' is sometimes not that easy to track down as the warning doesn't provide any hints.

Re: [sqlalchemy] Re: PyODBCConnector, possible wrong assumption re Unicode in bind parameters

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 10:48 AM, Michael Bayer wrote: It also makes me less than comfortable unconditionally emitting a u'' for a bound parameter as it appears to cause problems. I've also checked my SQL server, all databases including master are configured at SQL Server 2008 compatibility...

Re: [sqlalchemy] Seemingly inconsistent results with transaction isolation

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 10:39 AM, Russ wrote: Thanks for clarifying with a full answer! This should not be construed to mean that you should only use the ORM with SERIALIZABLE isolation. It's instead just something to be aware of. You can of course expire any object or individual attribute

[sqlalchemy] Re: PyODBCConnector, possible wrong assumption re Unicode in bind parameters

2011-09-09 Thread Victor Olex
What version of pyodbc? On Sep 9, 11:08 am, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 9, 2011, at 10:48 AM, Michael Bayer wrote: It also makes me less than comfortable unconditionally emitting a u'' for a bound parameter as it appears to cause problems. I've also checked my

Re: [sqlalchemy] Re: PyODBCConnector, possible wrong assumption re Unicode in bind parameters

2011-09-09 Thread Michael Bayer
2.1.9 from the github link you showed me. Just to make sure I also just cloned the tip from code.google.com and tried that one too. Has pyodbc made adjustments to changes in FreeTDS 0.91 ? On Sep 9, 2011, at 1:15 PM, Victor Olex wrote: What version of pyodbc? On Sep 9, 11:08 am,

Re: [sqlalchemy] Seemingly inconsistent results with transaction isolation

2011-09-09 Thread Russ
when you say query(Class).filter(criterion).one(), that always emits SQL. It's an open-ended query, and SQLalhcemy doesn't know that s2c1 is the object which corresponds to the SQL you're about to emit. When the row comes back, it then extracts the primary key from the incoming row,

Re: [sqlalchemy] Seemingly inconsistent results with transaction isolation

2011-09-09 Thread Michael Bayer
On Sep 9, 2011, at 5:11 PM, Russ wrote: when you say query(Class).filter(criterion).one(), that always emits SQL. It's an open-ended query, and SQLalhcemy doesn't know that s2c1 is the object which corresponds to the SQL you're about to emit. When the row comes back, it then extracts

[sqlalchemy] Re: PyODBCConnector, possible wrong assumption re Unicode in bind parameters

2011-09-09 Thread Victor Olex
Pyodbc has changes as late as this month. Misery likes company. When I tried to install this same stack on 64 bit architecture I am getting Segmentation fault errors for some queries. Easysoft has some info on ODBC in 64bit at http://www.easysoft.com/developer/interfaces/odbc/64-bit.html There are