[sqlalchemy] Re: howto Sqlalchemy atomic transaction ??

2011-11-21 Thread sajuptpm
Model class VDCTemplates(DeclarativeBase): __tablename__='cd_vdc_templates' id = Column(Unicode(50), primary_key=True) vdc_id=Column(Unicode(50), ForeignKey('cd_vdc.id', ondelete=CASCADE)) template_id=Column(Unicode(50), ForeignKey('cd_account_templates.id',

Re: [sqlalchemy] Re: howto Sqlalchemy atomic transaction ??

2011-11-21 Thread Robert Forkel
DBSession.flush() after the DBSession.add call might be enough. On Mon, Nov 21, 2011 at 12:48 PM, sajuptpm sajup...@gmail.com wrote: Model class VDCTemplates(DeclarativeBase):    __tablename__='cd_vdc_templates'    id = Column(Unicode(50), primary_key=True)    

[sqlalchemy] is there a problem in $ and % in a query using engine.execute?

2011-11-21 Thread Krishnakant Mane
Hello all. I am trying to write some code which after creating tables and related views trys to create the stored procedures (plpgsql). code goes some thing like this engine.execute(create or replace function addRecord(f1 text, f2 t1.fieldname%type ) returns bit as $$ ... begin ... end; $$

Re: [sqlalchemy] is there a problem in $ and % in a query using engine.execute?

2011-11-21 Thread Michael Bayer
try escaping the % sign as in %%. this is psycopg2's behavior. On Nov 21, 2011, at 1:27 PM, Krishnakant Mane wrote: Hello all. I am trying to write some code which after creating tables and related views trys to create the stored procedures (plpgsql). code goes some thing like this

Re: [sqlalchemy] Get a contains_eager collection to follow order_by

2011-11-21 Thread Michael Bayer
On Nov 21, 2011, at 12:12 AM, Yap Sok Ann wrote: Is it possible to get a contains_eager collection to follow the order_by defined in the relationship? It seems like with eager loading, the order_by defined will just be ignored (which I think make sense, just wondering if there is a better

[sqlalchemy] Translating T-SQL UPDATE FROM to SQLAlchemy

2011-11-21 Thread Andrew Buza
I'm working on translating some existing MS-dialect SQL over to SQLAlchemy(0.6.7) and I've run into a statement that's giving me a little trouble: UPDATE version SET doc =document.doc FROM document, version WHERE version.elnumber = document.elnumber AND version.elnumber = ? AND version.version =

Re: [sqlalchemy] Translating T-SQL UPDATE FROM to SQLAlchemy

2011-11-21 Thread Michael Bayer
On Nov 21, 2011, at 2:38 PM, Andrew Buza wrote: I'm working on translating some existing MS-dialect SQL over to SQLAlchemy(0.6.7) and I've run into a statement that's giving me a little trouble: UPDATE version SET doc =document.doc FROM document, version WHERE version.elnumber =

[sqlalchemy] map several objects at once ?

2011-11-21 Thread NiL
Hi list, In my use case I have groups that can include other groups (many to many) groups can also include users (many to many) users can 'have feelings' to other users (many to many) What I want to achieve is : for a given group, recursively find its sub users for each of those users, I need

Re: [sqlalchemy] Translating T-SQL UPDATE FROM to SQLAlchemy

2011-11-21 Thread Michael Bayer
On Nov 21, 2011, at 2:47 PM, Michael Bayer wrote: The various patches that need to be reconclied/tested are at: http://www.sqlalchemy.org/trac/ticket/1944 http://www.sqlalchemy.org/trac/ticket/2166 I've added a new patch that is good for inclusion in 0.7.4 to ticket #2166: