[sqlalchemy] Firebird - called a stored procedure which returns a value

2009-08-02 Thread Werner F. Bruhin
I can't figure quit figure this out. In an FB admin tool I can do: select * from T('some text orig', 'wbruhin'); or execute procedure T('some text orig', 'wbruhin'); And they return: a varchar some text orig auf Deutsch The following runs without error: ... me = session.query(db.Users).get(1)

[sqlalchemy] Re: Firebird - called a stored procedure which returns a value

2009-08-02 Thread werner
Correction, have to do a fetchxxx on the cursor to get the result. me = session.query(db.Users).get(1) cur = engine.raw_connection().cursor() cur.callproc('t', ('some text orig', me.name)) print cur.fetchone() On Aug 2, 6:04 pm, Werner F. Bruhin wbru...@gmail.com wrote: I can't figure quit

[sqlalchemy] Thread problem

2009-08-02 Thread drakkan
Hi all, I know sqlalchemy session is not thread safe but in my application I need to use thread, I have my session defined as following: engine = create_engine(connectionstring, echo=settings.DEBUG, echo_pool=settings.DEBUG, pool_size=20,

[sqlalchemy] Re: Thread problem

2009-08-02 Thread drakkan
here is a sample sa output when the application hangs: 009-08-03 01:05:20,458 INFO sqlalchemy.engine.base.Engine.0x...1634 {'param_1': None} 2009-08-03 01:05:33,673 INFO sqlalchemy.engine.base.Engine.0x...1634 SELECT tipallarmi.id AS tipallarmi_id, tipallarmi.codice AS tipallarmi_codice,

[sqlalchemy] Re: Thread problem

2009-08-02 Thread drakkan
After the select there is an insert, can three concurrent threads inserting data in the same table cause the hang? If so how can I avoid this? Please note that until now the same application was using django orm with no deadlock problems, I only changed the query to use sqlalchemy thanks

[sqlalchemy] Re: Thread problem

2009-08-02 Thread drakkan
The problem is riproducible with this simple script: import samodels as sa import threading def insertalarm(): s=sa.Session a=sa.Allarmi(s.query(sa.TipoAllarmi).get(1)) s.add(a) s.commit() for i in range(100): t=threading.Thread(target=insertalarm)

[sqlalchemy] Re: Thread problem

2009-08-02 Thread Michael Bayer
theres nothing wrong with what is illustrated, save for that most workstations can't run anywhere near 100 concurrent threads/INSERTS/pg connections at the same time. it goes without saying that showing fragments of code is not very useful since your results cannot be verified. On Aug 2,

[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'dict'

2009-08-02 Thread rajasekhar911
the error can be reproduced by adding __getattr__ method to the model class. my model class has some attributes that are lazy initialized and are not mapped to any table columns. i am using the getattr method to implement the lazy initialization. On Jul 31, 6:15 pm, Michael Bayer

[sqlalchemy] Re: Thread problem

2009-08-02 Thread Michael Bayer
heres my script, runs fine from sqlalchemy import * from sqlalchemy.orm import * e = create_engine('postgres://scott:ti...@localhost/test', echo=True) m = MetaData(e) t1 = Table('t1', m, Column('a', Integer, primary_key=True), Column('b', Integer)) t2 = Table('t2', m, Column('a', Integer,