Re: [sqlalchemy] 'collation' keyword to String() doesn't work

2010-07-28 Thread Michael Bayer
The type descriptions from that page are missing, and that paragraph is incorrect and out of date. In 0.6 we use UPPERCASE for vendor specific types since they are exactly what they are (in this case VARCHAR).Dialect specific types come from that dialect, see http://www.sqlalchemy.org/doc

[sqlalchemy] 'collation' keyword to String() doesn't work

2010-07-28 Thread Trent Nelson
According to [1], the following should work: >>> import sqlalchemy >>> sqlalchemy.__version__ '0.6.3' >>> sqlalchemy.String(14, collation='Latin1_General_CS_AS') Traceback (most recent call last): File "", line 1, in TypeError: __init__() got an unexpected keyword argument 'collation' Thought

[sqlalchemy] Re: Exists clause on relations of different mapped objects

2010-07-28 Thread Kalium
On Jul 28, 11:37 pm, Michael Bayer wrote: > On Jul 27, 2010, at 9:59 PM, Kalium wrote: > > > I'm trying to determine whether or not there are any value in one > > mapped object relation that correspond to another  mapped object > > relation > > > i.e > > A.x - represents a relation of x's on A >

[sqlalchemy] Re: mismatched parameter markers when running on Mac OS X

2010-07-28 Thread fulv
Thanks. Yes, I am indeed connecting to MS SQL. I got everything working after upgrading to SQLAlchemy 0.6.3. This required some rework, to rip out collective.lead (which does not support recent versions of SQLAlchemy) and replace it with z3c.saconfig. I am still using unixodbc, though, installed

Re: [sqlalchemy] session.execute with autocommit option turned on is a no-op

2010-07-28 Thread Michael Bayer
On Jul 28, 2010, at 2:33 PM, Faheem Mitha wrote: > > Hi, > > In the following script, the last line, namely > > session.execute("select * from drop_constraint_if_exists('foo', 'foo_pkey', > 'public');") > > doesn't drop the constraint. It does if autocommit is turned off, and a > session.co

[sqlalchemy] session.execute with autocommit option turned on is a no-op

2010-07-28 Thread Faheem Mitha
Hi, In the following script, the last line, namely session.execute("select * from drop_constraint_if_exists('foo', 'foo_pkey', 'public');") doesn't drop the constraint. It does if autocommit is turned off, and a session.commit() is issued after the statement. The autocommit setting works w

[sqlalchemy] Re: open session blocks metadata create_all method

2010-07-28 Thread Faheem Mitha
In gmane.comp.python.sqlalchemy.user, you wrote: > --=-QALfoiit8f0M60C7Zms+ > Content-Type: text/plain; charset=ISO-8859-1 > > On Wed, 2010-07-28 at 17:17 +, Faheem Mitha wrote: > >> Hi Lance, >> >> On Wed, 28 Jul 2010 06:45:30 -0500, Lance Edgar >> wrote: >> > --=-dKyzuPx4woj1H0B5IT48 >> >

Re: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-28 Thread Lance Edgar
On Wed, 2010-07-28 at 17:17 +, Faheem Mitha wrote: > Hi Lance, > > On Wed, 28 Jul 2010 06:45:30 -0500, Lance Edgar wrote: > > --=-dKyzuPx4woj1H0B5IT48 > > Content-Type: text/plain; charset=ISO-8859-1 > > > > On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote: > > > >> On Wed, 28 Jul 2010

[sqlalchemy] Re: open session blocks metadata create_all method

2010-07-28 Thread Faheem Mitha
Hi Lance, On Wed, 28 Jul 2010 06:45:30 -0500, Lance Edgar wrote: > --=-dKyzuPx4woj1H0B5IT48 > Content-Type: text/plain; charset=ISO-8859-1 > > On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote: > >> On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha >> wrote: >> > >> > Hi, >> >> > When

[sqlalchemy] Making a copy of a table

2010-07-28 Thread Massi
Hi everyone, I'm getting in trouble in th attempt to create a simple copy (structure and data) of a table in my database (sql server). I need the SQLAlchemy equivalent of the query: SELECT * INTO newtable FROM table How can I achieve this? I found that tometadata probably could do the trick, but

Re: [sqlalchemy] Updating db schema without using migrate

2010-07-28 Thread Michael Bayer
On Jul 28, 2010, at 9:09 AM, Emanuele Gesuato wrote: > Hi there, > > I'm using sqlalchemy 0.5 with python 2.5 for a desktop application. I > know that if the database is empty sqlalchemy can create automatically > all the tables needed. But what if i have to add some new tables or > columns or d

Re: [sqlalchemy] association_proxy problem

2010-07-28 Thread Michael Bayer
thanks for sending a nice, succinct example...very rare these days. Use this: class GroupClient(Base): __tablename__ = 'clientgroup' client_id = Column('client_id', Integer, ForeignKey('client.id'),primary_key = True) group_id = Column('group_id', Integer, ForeignKey('group.id'), p

Re: [sqlalchemy] Exists clause on relations of different mapped objects

2010-07-28 Thread Michael Bayer
On Jul 27, 2010, at 9:59 PM, Kalium wrote: > I'm trying to determine whether or not there are any value in one > mapped object relation that correspond to another mapped object > relation > > i.e > A.x - represents a relation of x's on A > B.x - represents a relation of x's on B > > They both

[sqlalchemy] Updating db schema without using migrate

2010-07-28 Thread Emanuele Gesuato
Hi there, I'm using sqlalchemy 0.5 with python 2.5 for a desktop application. I know that if the database is empty sqlalchemy can create automatically all the tables needed. But what if i have to add some new tables or columns or delete columns ? I would like to update the schema in the startup of

[sqlalchemy] association_proxy problem

2010-07-28 Thread DimonB
Hi! When trying to remove element from association_proxy exception occure. Here is code example: ## CODE EXAMPLE # from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta from sqlalchemy.ext.associationproxy import

Re: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-28 Thread Lance Edgar
On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote: > On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha > wrote: > > > > Hi, > > > When calling create_all on a metadata instance after a session has > > alrady been opened causes the create_all to hang, I assume because > > the session is

[sqlalchemy] Re: open session blocks metadata create_all method

2010-07-28 Thread Faheem Mitha
On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha wrote: > > Hi, > When calling create_all on a metadata instance after a session has > alrady been opened causes the create_all to hang, I assume because > the session is blocking the create_all. Is there some way to get > create_all to use t

[sqlalchemy] open session blocks metadata create_all method

2010-07-28 Thread Faheem Mitha
Hi, When calling create_all on a metadata instance after a session has alrady been opened causes the create_all to hang, I assume because the session is blocking the create_all. Is there some way to get create_all to use the existing session, or any other graceful way around this? Thanks. I