[sqlalchemy] SQLAlchemy mapped classes and __new__ (ClassManager.new_instance undocumented)

2011-06-28 Thread Torsten Landschoff
Hi *, a while ago I noticed a small problem with SQLAlchemy. I was able to work around this, but I am still wondering if this should be required. I am doing synchronization between multiple databases (think distributed VCS). Basically, each outdated object on the receiving side is updated by

[sqlalchemy] strange commit behaviour

2011-06-28 Thread NiL
Hi list, I have a turbogears controller, the model are elixir defined. def copy(self, scenario_id, **kwargs): copy a scenario :param scenario_id: id of a :class:`model.Scenario` :type media_id: string user =

Re: [sqlalchemy] SQLAlchemy mapped classes and __new__ (ClassManager.new_instance undocumented)

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 3:45 AM, Torsten Landschoff wrote: Hi *, a while ago I noticed a small problem with SQLAlchemy. I was able to work around this, but I am still wondering if this should be required. I am doing synchronization between multiple databases (think distributed VCS).

Re: [sqlalchemy] strange commit behaviour

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 4:29 AM, NiL wrote: Hi list, I have a turbogears controller, the model are elixir defined. def copy(self, scenario_id, **kwargs): copy a scenario :param scenario_id: id of a :class:`model.Scenario` :type media_id: string

[sqlalchemy] (OperationalError) (1066, Not unique table/alias: '...') when selecting only from a joined table

2011-06-28 Thread Oliver
I want to have the following query in sqlalchemy: SELECT t_objects_1.tid AS t_objects_1_tid FROM t_objects AS t_objects_2 INNER JOIN c_objects AS c_objects_1 ON t_objects_2.tid = c_objects_1.tid INNER JOIN t_objects AS t_objects_1 ON t_objects_1.tid = t_objects_2.parent_id WHERE c.id = 1; this

Re: [sqlalchemy] (OperationalError) (1066, Not unique table/alias: '...') when selecting only from a joined table

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 12:26 PM, Oliver wrote: I want to have the following query in sqlalchemy: SELECT t_objects_1.tid AS t_objects_1_tid FROM t_objects AS t_objects_2 INNER JOIN c_objects AS c_objects_1 ON t_objects_2.tid = c_objects_1.tid INNER JOIN t_objects AS t_objects_1 ON

[sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Alexandre Conrad
Hi list, So I am working on a project with SQLAlchemy using MSSQL as a back-end DB and I need to add a WITH (nolock) statement to all my queries implicitly. Even for the .get(pk_id) method. Mike actually pointed me to the .with_hint() method on the Query object but I couldn't get it to work. PS:

RE: [sqlalchemy] (OperationalError) (1066, Not unique table/alias: '...') when selecting only from a joined table

2011-06-28 Thread King Simon-NFHD78
Michael Bayer wrote: - I am loathe to reference the 0.5 docs as people keep finding them and thinking they are current, but an example of this is at http://www.sqlalchemy.org/docs/05/ormtutorial.html#querying-with- joins (Note to people reading this: these are the *OLD DOCS* regarding 0.5;

Re: [sqlalchemy] (OperationalError) (1066, Not unique table/alias: '...') when selecting only from a joined table

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 1:31 PM, King Simon-NFHD78 wrote: Michael Bayer wrote: - I am loathe to reference the 0.5 docs as people keep finding them and thinking they are current, but an example of this is at http://www.sqlalchemy.org/docs/05/ormtutorial.html#querying-with- joins (Note to

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 12:55 PM, Alexandre Conrad wrote: Hi list, So I am working on a project with SQLAlchemy using MSSQL as a back-end DB and I need to add a WITH (nolock) statement to all my queries implicitly. Even for the .get(pk_id) method. Mike actually pointed me to the .with_hint()

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Alexandre Conrad
I must have it wrong, I admit I don't quite understand the arguments of .with_hint() session.query(User).with_hint(User, 'WITH (nolock)').get(1) if that makes any sense (I wonder why I'd need to pass the User object again). 2011/6/28 Michael Bayer mike...@zzzcomputing.com: On Jun 28, 2011, at

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 2:55 PM, Alexandre Conrad wrote: I must have it wrong, I admit I don't quite understand the arguments of .with_hint() session.query(User).with_hint(User, 'WITH (nolock)').get(1) if that makes any sense (I wonder why I'd need to pass the User object again). well HINT

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 2:55 PM, Alexandre Conrad wrote: I must have it wrong, I admit I don't quite understand the arguments of .with_hint() session.query(User).with_hint(User, 'WITH (nolock)').get(1) if that makes any sense (I wonder why I'd need to pass the User object again).

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Doug Morgan
We have to use the 'WITH (nolock)' because of legacy requirements; however, we will look into the isolation level comment and see what our DBAs say. Oh, and thanks for the help Mike, we'll test that patch and see if it works and report back (along with anything we get on the isolation level).

[sqlalchemy] Re: strange commit behaviour

2011-06-28 Thread NiL
thanks for your prompt reply still if I do something like http://pastebin.com/UMRcYjp3 (The ordering in children demo is pointless for what I care now) It freezes against a PG database, I need to drop the tables for a second test to run in isolation, and I can't manage to, the commit isn't

Re: [sqlalchemy] SQLAlchemy 0.6.5 (and 0.6.8) SessionExtension after_flush doesn't gets called

2011-06-28 Thread kost BebiX
Oh, thank you very much, that makes sense to me (and I knew I am wrong somewhere because there are even tests for those after_flush events that work). -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit

Re: [sqlalchemy] Re: strange commit behaviour

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 4:29 PM, NiL wrote: thanks for your prompt reply still if I do something like http://pastebin.com/UMRcYjp3 (The ordering in children demo is pointless for what I care now) It freezes against a PG database, I need to drop the tables for a second test to run in

[sqlalchemy] Persist an object on multiple tables across multiple shards

2011-06-28 Thread Arthur Kopatsy
Hi, Here is the scenario. I have two objects: node and edge. My DB is sharded on node ids. Edges connect two node ids. I have essentially three tables: node, inboundEdge, outboundEdge. If an edge (A,B) is created, I want it to be persisted in the inbound edge table of node B shard and in the

[sqlalchemy] Problem with DeclarativeMeta

2011-06-28 Thread Mike Conley
We have a database of about 100 tables with timestamp audit columns on most, but not all tables, and use declarative to describe the database. I am attempting to use a metaclass to create a base class that defines the audit columns so we can stop defining them on every class. This seems to work OK

[sqlalchemy] In case of joinedload_all how do I order by on a columns of those relations

2011-06-28 Thread Marc Van Olmen
Hi I'm trying to order by a column from a relationship. Taken example from: http://www.sqlalchemy.org/docs/orm/loading.html#routing-explicit-joins-statements-into-eagerly-loaded-collections In case of query.options(joinedload_all('orders.items.keywords'))... or

[sqlalchemy] Slightly confusing error when session set up incorrectly

2011-06-28 Thread Ben Sizer
Hello all, When using sqlalchemy 0.7 with sqlite, if I enter the path URI incorrectly I will get an error like this: OperationalError: (OperationalError) unable to open database file None None What does the None None signify? Would it be possible to change this exception to be a bit more

Re: [sqlalchemy] Slightly confusing error when session set up incorrectly

2011-06-28 Thread Michael Bayer
On Jun 28, 2011, at 9:34 PM, Ben Sizer wrote: Hello all, When using sqlalchemy 0.7 with sqlite, if I enter the path URI incorrectly I will get an error like this: OperationalError: (OperationalError) unable to open database file None None What does the None None signify? Would it