Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Lenza McElrath
Well, turns out that it doesn't take much of a pool at all to get the test to fail: http://pastebin.com/trHhiG47 On Thu, Nov 4, 2010 at 10:33 PM, Lenza McElrath le...@lenza.org wrote: Interesting. When I use your simple engine I do not get the error either, but I definitely get it when using

Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Michael Bayer
On Nov 5, 2010, at 2:51 AM, Lenza McElrath wrote: Well, turns out that it doesn't take much of a pool at all to get the test to fail: http://pastebin.com/trHhiG47 sorry, again this works fine, and theres still nothing in the test as given that can cause StaleDataError. output when I add

[sqlalchemy] Re: Creating tables in correct order

2010-11-05 Thread Richie Ward
I think I am using the same declarative_base instance but it is still making the tables in the wrong order. My model is at: http://bazaar.launchpad.net/~richies/hypernucleus-server/PylonsPortExperimental/files/head%3A/hypernucleusserver/model/ And here is what happens when I run: paster

[sqlalchemy] Is it possible to do two heritance with joined table inheritance mechanism ?

2010-11-05 Thread Stéphane Klein
Hi, this is a example with « joined table inheritance » feature : class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) discriminator = Column('type', String(50)) __mapper_args__ = {'polymorphic_on': discriminator} class Contact(Base):

[sqlalchemy] Re: Creating tables in correct order

2010-11-05 Thread Richie Ward
I have put my problem in a small program for easy understanding. Run this with MySQL. from sqlalchemy import create_engine, __version__ from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import

[sqlalchemy] Delete db file previously managed by SqlAlchemy.create_engine

2010-11-05 Thread kelkoosarahc
Hello, I use sqlAlchemy to manage db file then I would like to remove this db file for tree directory but I get a WindowsError [Error 32] : The process cannot access the file because it is being used by another process. Please see the code below : dbEngine =

Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Lenza McElrath
Here is my output. Note that my updates are for 0.2 not 0.. Both Python 2.5.2 and 2.6.5 interpret the test_value this way. I wonder if you are not seeing the error due to the float changes in Python 2.7? $ uname -a Linux dev05 2.6.24-24-server #1 SMP Wed Apr 15

Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Michael Bayer
so, what has to be happening is cursor.rowcount is returning zero, when it should be 1. The version of MySQL as well as MySQLdb here could play a role. I would try ensuring you're on the latest MySQLdb, trying the same script against other MySQL installations. Try converting the script

[sqlalchemy] Table Inheritance

2010-11-05 Thread Mark Erbaugh
Please refer to the Joined Table Inheritance Section under declarative.ext (I'm using SA 0.5.8). Is is possible to create a Person who is both an Engineer and a Manager using joined table inheritance? IOW, both Manager and Engineer would link to the same row in Person. Thanks, Mark -- You

[sqlalchemy] Re: Is it possible to do two heritance with joined table inheritance mechanism ?

2010-11-05 Thread Stéphane Klein
On Nov 5, 12:01 pm, Stéphane Klein steph...@harobed.org wrote: Hi, this is a example with « joined table inheritance » feature : class User(Base):     __tablename__ = 'users'     id = Column(Integer, primary_key=True)     discriminator = Column('type', String(50))     __mapper_args__ =

Re: [sqlalchemy] Is it possible to do two heritance with joined table inheritance mechanism ?

2010-11-05 Thread Michael Bayer
On Nov 5, 2010, at 7:01 AM, Stéphane Klein wrote: Hi, this is a example with « joined table inheritance » feature : class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) discriminator = Column('type', String(50)) __mapper_args__ =

Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Lenza McElrath
This is happening using MySQLdb 1.2.2 and MySQL server 5.0.87. Upgrading is not really a viable option. I guess you expect cursor.rowcount to be the number of matched rows, not the number of changed rows? Where is the documentation that says this is what it should be? Obviously no rows are

Re: [sqlalchemy] Avoiding StaleDataError when updating Float values

2010-11-05 Thread Michael Bayer
On Nov 5, 2010, at 1:04 PM, Lenza McElrath wrote: This is happening using MySQLdb 1.2.2 and MySQL server 5.0.87. Upgrading is not really a viable option. Wasn't asking you to upgrade. Only to try a different version of the software in an attempt to isolate the issue. I guess you

[sqlalchemy] InternalError

2010-11-05 Thread Michael Hipp
I'm doing a simple query like this, to get a list of dealers with open invoices: session.query(Invoice.dealer_id, Dealer.name). outerjoin((Dealer, Invoice.dealer)). group_by(Invoice.dealer_id, Dealer.name). all() Which produces this SQL: SELECT invoices.dealer_id AS

Re: [sqlalchemy] InternalError

2010-11-05 Thread Michael Hipp
On 11/5/2010 2:50 PM, Michael Hipp wrote: That SQL runs perfectly when given directly to PostgreSQL, but SQLAlchemy is reporting a DB-API error: sqlalchemy.exc.InternalError: (InternalError) current transaction is aborted, commands ignored until end of transaction block Nevermind. I noticed

[sqlalchemy] Read-only transactions

2010-11-05 Thread Yang Zhang
Hi, we're building an application where we're distinguishing strictly between read-only and read-write transactions, so we'd like to (as a sanity measure) ensure that we're not inadvertently doing any writing from the read-only sections. What's the simplest way to catch writes with sqlalchemy?

Re: [sqlalchemy] Read-only transactions

2010-11-05 Thread Michael Bayer
On Nov 5, 2010, at 8:48 PM, Yang Zhang wrote: Hi, we're building an application where we're distinguishing strictly between read-only and read-write transactions, so we'd like to (as a sanity measure) ensure that we're not inadvertently doing any writing from the read-only sections.

[sqlalchemy] 'list' object has no attribute '_state'

2010-11-05 Thread pianoman
Hi I feel I have exhausted all the usual options in finding a solution for this problem. I'm using Python 2.5.5, SQLAlchemy 0.4.6, and Elixir 0.5.2. I'm really not sure how much code I should include for this to make any sense to others.