[sqlalchemy] sqa core: check for update failure

2014-04-24 Thread pr64
Hi, I'm using SQA core to improve my app performance. I'v got the following db update request: engine.execute(Person.__table__.update().\ where(Person.name == peter).\ values(is_stafff=True)) When peter does not exist, is there a

[sqlalchemy] Re: Strange behaviour in multi-process environment

2014-01-21 Thread pr64
() my_object = session.query(...).one() session.refresh(my_object) # - is this line needed? return my_object Thanks again for your time supporting a newbie. Pierre On Monday, January 20, 2014 5:12:58 PM UTC+1, pr64 wrote: Hi, Strange behaviour with sqa in multi-process

[sqlalchemy] Re: Strange behaviour in multi-process environment

2014-01-21 Thread pr64
) session_maker = scoped_session(session_factory) session = session_maker() Is this a correct way to achieve multi-process correct behaviour? Thanks On Monday, January 20, 2014 5:12:58 PM UTC+1, pr64 wrote: Hi, Strange behaviour with sqa in multi-process environment... already posted

[sqlalchemy] Strange behaviour in multi-process environment

2014-01-20 Thread pr64
Hi, Strange behaviour with sqa in multi-process environment... already posted on StackOverflow for a web app but still missing some understanding so posting here. I've created an application where my sqa calls are encapsulated: My API's methods always do the same kind of stuff: 1- request

[sqlalchemy] Strange behaviour in multi-process environment

2014-01-20 Thread pr64
Hi, Strange behaviour with sqa in multi-process environment... already posted on StackOverflowhttp://stackoverflow.com/questions/21109794/delayed-change-using-sqlalchemyfor a web app but still missing some understanding so posting here. I've created an application where my sqa calls are

Re: [sqlalchemy] Strange behaviour in multi-process environment

2014-01-20 Thread pr64
Thanks for your comments. I'm using sqlite in default mode (which is synchronous) and here's my engine configuration. engine = create_engine('sqlite:///my_db.sqlite', connect_args={'detect_types': sqlite3.PARSE_DECLTYPES|

[sqlalchemy] Re: Strange behaviour in multi-process environment

2014-01-20 Thread pr64
() On Monday, January 20, 2014 5:12:58 PM UTC+1, pr64 wrote: Hi, Strange behaviour with sqa in multi-process environment... already posted on StackOverflowhttp://stackoverflow.com/questions/21109794/delayed-change-using-sqlalchemyfor a web app but still missing some understanding so posting

[sqlalchemy] relationship auto update

2014-01-03 Thread pr64
Hi, Newbie question on relationships. Consider the following code. When deleting a child, I would like the parent *.children* attribute to be automatically updated by the orm. It is not : am I doing something wrong or missed some configuration ? Thanks a lot! Pierre #!/usr/bin/env python #

[sqlalchemy] relationship auto updates

2014-01-03 Thread pr64
Hi, Sorry for the previous post. Attached script had a typo. When deleting a child, I would like the children list of the parent to be automatically updated... Am i doing something wrong or missed some configuration ? Please note that i'm using sqa 0.8.4. Thanks Pierre #!/usr/bin/env

Re: [sqlalchemy] SQLAlchemy hot-copy capability

2013-09-19 Thread pr64
HI everyone, First, i would like to thank you for your comments. Then, for those who run linux, the following works: 1- copy your db.sqlite to /dev/shm/db.sqlite (thus in ram fs) 2- play with it through sqlalchemy 3- backup it to disk when needed src =

[sqlalchemy] SQLAlchemy hot-copy capability

2013-08-30 Thread pr64
Hi, I'm currently running several python applications (each app using sqlalchemy) accessing (read/write) a single SQLite database stored on disk. For performance reasons, I would like to store this db file in RAM memory (ie, in my /dev/shm) The applications would then access a shared

[sqlalchemy] SQLite synchronous on engine

2013-06-19 Thread pr64
Hi, In order to improve the underlying SQLite performance, I've changed some low level settings with PRAGMA commands: PRAGMA synchronous=NORMAL; /* instead of default FULL value, see: http://www.sqlite.org/pragma.html#pragma_synchronous */ PRAGMA journal_mode=WAL; /*

Re: [sqlalchemy] Re: NullPool for sqlite (Operational error: no such table)

2012-05-24 Thread pr64
Example code is: orm = OrmManager() session = orm.get_session() my_obj = session.query() my_obj.attribute = 'new value' session.commit() I can see an issue here, talking to you. We used the SingleThreadedPool with pool_size=50. But looking at our code, it seems that we never

[sqlalchemy] Get 'full' child when querying inherited tables

2012-05-24 Thread pr64
Hi, For some reason, I need to access my sqlite database through an API which encapsulates the sqlalchemy stuff. In my api methods, the typical sequence is: 1. get a session from the session maker 2. query/commit the db using this session 3. return the queried/commited object and close

Re: [sqlalchemy] Get 'full' child when querying inherited tables

2012-05-24 Thread pr64
Worked perfectly. Thanks a lot for your quick answer and so great software. Le jeudi 24 mai 2012 16:45:50 UTC+2, Michael Bayer a écrit : On May 24, 2012, at 10:02 AM, pr64 wrote: Hi, For some reason, I need to access my sqlite database through an API which encapsulates the sqlalchemy

[sqlalchemy] NullPool for sqlite (Operational error: no such table)

2012-05-23 Thread pr64
Hi, Using SQLAlchemy 0.7.7 with an underlying sqlite databse, we configured the engine with poolclass=SingletonThreadPool and pool_size=50 Our unit-tests were working fine. But when running the app, some (ProgrammingError) Cannot work on a closed database occured. Reading the docs and mailist

[sqlalchemy] Re: NullPool for sqlite (Operational error: no such table)

2012-05-23 Thread pr64
On May 23, 3:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On May 23, 2012, at 5:04 AM, pr64 wrote: Hi, Using SQLAlchemy 0.7.7 with an underlying sqlite databse, we configured the engine with poolclass=SingletonThreadPool and pool_size=50 Our unit-tests were working fine

Re: [sqlalchemy] Re: NullPool for sqlite (Operational error: no such table)

2012-05-23 Thread pr64
We tried to switch from SingletonThreadPool (which raises errors, sometimes) to StaticPool... we'll see what happens. The problem is that this error is not systematically raised and it seems that it is raised when multiple threads are accessing the db. StaticPool can't be used for

[sqlalchemy] Several many to many table joins with sqlalchemy

2011-01-13 Thread pr64
Hi, New with SQLalchemy, here is my problem: My model is: user_group_association_table = Table('user_group_association', Base.metadata, Column('user_id', Integer, ForeignKey('user.id')), Column('group_id', Integer, ForeignKey('group.id')) ) department_group_association_table =

[sqlalchemy] unittest assertRaises does not catch NoResultFound

2011-01-11 Thread pr64
Hi, New with sqlalchemy, i'm trying to unittest my code: import unittest import os from sqlalchemy.orm.exc import NoResultFound import User SQLITE_FILE = 'test.db' class UserAddTestCase(unittest.TestCase): def setUp(self): ... some code which create the session (removed to be