[sqlalchemy] Sharing types between dialects

2010-05-06 Thread George V. Reilly
Our production database uses MySQL. For various reasons, the schema often uses MySQL-specific DDL. We want that represented in our mapper classes. We also awant to be able to exercise our SQLAlchemy unit tests against both local MySQL databases and SQLite databases. Using the MySQL-specific types

[sqlalchemy] Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias
Hi, I am using SQLAlchemy 0.6 together with cx_Oracle and I am receiving an error message when a database function is inside a package and has to be called like package.functionname. For example the following query can reproduce the error (beside that this query makes not much sense):

[sqlalchemy] how to handle deadlock

2010-05-06 Thread rajasekhar911
Hi I am using sqlalchemy0.5.5 in my TG2 app with mysql(innodb) database My applicaton is multithreaded. there are multiple tasks that run at certain intervals. in one of my tables i am getting the following deadlock error. Deadlock found when trying to get lock; try restarting transaction the

[sqlalchemy] Re: Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias
By accident I found out that the SQLAlchemy Function class has an attribute 'packagenames'. If you set this attribute manually, the query is executed properly. It would be great if this attribute is filled automatically by splitting the function name on every dot.

Re: [sqlalchemy] how to handle deadlock

2010-05-06 Thread gary clark
try: Perform table transaction break except: rollback delay try again to perform table transaction I'm sure you will get the gist of the above and why. I also set my isolation_level to READ UNCOMMITED. Thanks, Garyc --- On Thu, 5/6/10, rajasekhar911

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-06 Thread Michael Bayer
On May 5, 2010, at 11:46 PM, Kyle Schaffrick wrote: 1. While you can override existing operators that work on ColumnElements without doing much funny business, if you want to add *new* operations to it, the abstractions leak fairly badly. This seems to be because operator definitions aren't

Re: [sqlalchemy] Re: Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Michael Bayer
On May 6, 2010, at 7:47 AM, Tobias wrote: By accident I found out that the SQLAlchemy Function class has an attribute 'packagenames'. If you set this attribute manually, the query is executed properly. It would be great if this attribute is filled automatically by splitting the function

Re: [sqlalchemy] Re: Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias Sauerwein
Thanks for your reply! I always thought that func.package.name(..) would be the same as calling getattr(func, 'package.name')(..), but now I understand how the class _FunctionGenerator works. :) Because I only have the function name as string, I can't use the func.xy construct. I am now manually

Re: [sqlalchemy] Reflecting all tables in a database that creates objects with declarative objects

2010-05-06 Thread Michael Bayer
On May 5, 2010, at 5:12 PM, Michael Bayer wrote: Since Python allows dynamic generation of classes, there are easy ways to deal with this. I forgot to mention a system that works almost like the recipe I gave is the SQLSoup extension, you might like it a lot:

[sqlalchemy] Numeric not consistent between Postgres and Oracle in 0.6

2010-05-06 Thread Kent Bower
The following has changed since 0.5.8 in 0.6.0. I believe this is already known or by design from reading docs and another post but want to point out. If you specify a column such as this: Column(saleprice, Numeric, nullable=False) you get a 'numeric' type in PostgreSQL, which supports

[sqlalchemy] Re: Numeric not consistent between Postgres and Oracle in 0.6

2010-05-06 Thread Kent
I guess my suggestion is: since Oracle takes DECIMAL and NUMERIC to mean NUMBER(38), if SQLAlchemy interprets the generic types DECIMAL or Numeric with no precision to allow for decimal or integer values, we should translate that to 'NUMBER' for Oracle... Thoughts? On May 6, 12:11 pm, Kent

Re: [sqlalchemy] Numeric not consistent between Postgres and Oracle in 0.6

2010-05-06 Thread Michael Bayer
On May 6, 2010, at 12:11 PM, Kent Bower wrote: The following has changed since 0.5.8 in 0.6.0. I believe this is already known or by design from reading docs and another post but want to point out. If you specify a column such as this: Column(saleprice, Numeric, nullable=False) you

Re: [sqlalchemy] Re: Numeric not consistent between Postgres and Oracle in 0.6

2010-05-06 Thread Michael Bayer
On May 6, 2010, at 12:23 PM, Kent wrote: I guess my suggestion is: since Oracle takes DECIMAL and NUMERIC to mean NUMBER(38), if SQLAlchemy interprets the generic types DECIMAL or Numeric with no precision to allow for decimal or integer values, we should translate that to 'NUMBER' for

[sqlalchemy] joins use old data

2010-05-06 Thread Kent
Note behavior: Script: = from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('postgres://salespylot:salespy...@localhost: 5444/salespylot',echo=True) metadata = MetaData() Session = sessionmaker(bind=engine) DBSession =

Re: [sqlalchemy] joins use old data

2010-05-06 Thread Michael Bayer
On May 6, 2010, at 2:29 PM, Kent wrote: ord=DBSession.query(Order).get(u'SALE65424') ord.customerid #this returns the current value, '7' ord.customerid = u'8' #update this value ord.customer # lazy load === Even after

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-06 Thread Kyle Schaffrick
On Thu, 6 May 2010 10:39:28 -0400 Michael Bayer mike...@zzzcomputing.com wrote: On May 5, 2010, at 11:46 PM, Kyle Schaffrick wrote: 1. While you can override existing operators that work on ColumnElements without doing much funny business, if you want to add *new* operations to it, the

[sqlalchemy] Re: Sharing types between dialects

2010-05-06 Thread George V. Reilly
Thanks, Michael. On May 6, 7:48 am, Michael Bayer mike...@zzzcomputing.com wrote: On May 6, 2010, at 3:35 AM, George V. Reilly wrote: Our production database uses MySQL. For various reasons, the schema often uses MySQL-specific DDL. We want that represented in our mapper classes. We also