Re: [sqlalchemy] Re: short drop_all question

2012-02-28 Thread Chris Withers
On 25/02/2012 11:07, lars van gemerden wrote: Actually, now I think about it, i had a couple of reasons: - easy to start with (no separeate installation is i remember correctly) ...but bear in mind that it's a very weak database in terms of functionality... - no decision required about

[sqlalchemy] mysql isolation _level

2012-02-28 Thread Ashish
How to set isolation_level for mysql create_enggine in pool configuration code. currently i get following error: Invalid argument(s) 'isolation_level' sent to create_engine(), using configuration MySQLDialect_mysqldb/QueuePool/Engine. Please check that the keyword arguments are appropriate for

[sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread naktinis
Column anon_1.anon_2 is generated in the following scenario: dbsession.query(FirstThing, FirstThing.moved_by.any(User.id == user_id)).options(joinedload_all('some_property')) query = query.join(SecondThing, SecondThing.first_thing_id == FirstThing.id) query =

[sqlalchemy] engine in column_reflect events

2012-02-28 Thread Eric Lemoine
Hi I'd like to do queries from a column_reflect listener, but this isn't currently possible because column_reflect events do not include an engine/bind object. Would adding a bind key/value to the column_info argument make sense? FYI, I'm trying to reflect PosGIS geometry columns. Thank you.

Re: [sqlalchemy] mysql isolation _level

2012-02-28 Thread Michael Bayer
it's the development version. for the moment you can get it like this: http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz On Feb 28, 2012, at 8:45 AM, Ashish wrote: How to set isolation_level for mysql create_enggine in pool configuration code. currently i get following error:

Re: [sqlalchemy] engine in column_reflect events

2012-02-28 Thread Michael Bayer
wowwell yeah, though putting it in the column_info is not how i'd want to do that. I'd like to change the API for 0.8.Actually the whole inspector should be passed to the event. this is http://www.sqlalchemy.org/trac/ticket/2418 which has a patch. For now, uerg, putting in the

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread Michael Bayer
On Feb 28, 2012, at 9:40 AM, naktinis wrote: Column anon_1.anon_2 is generated in the following scenario: dbsession.query(FirstThing, FirstThing.moved_by.any(User.id == user_id)).options(joinedload_all('some_property')) query = query.join(SecondThing, SecondThing.first_thing_id ==

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread naktinis
I should have pointed out that I got a NoSuchColumnError because of anon_1.anon_2. There is no column anon_2 in any of the tables. It's just an alias name of a derived table. Is table_name_1.table_name_2 supposed to mean anything? On Tuesday, February 28, 2012 5:53:42 PM UTC+2, Michael Bayer

Re: [sqlalchemy] engine in column_reflect events

2012-02-28 Thread Eric Lemoine
On Tue, Feb 28, 2012 at 4:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: wowwell yeah, though putting it in the column_info is not how i'd want to do that.  I'd like to change the API for 0.8.    Actually the whole inspector should be passed to the event.   this is

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread Michael Bayer
it appears here the anon_2 is a label being given to your otherwise unnamed FirstThing.moved_by.any() call, which is a subquery. you're not showing me the full query being rendered but I would imagine the important bits are: SELECT anon_1.anon_2 AS anon_1_anon_2 FROM (SELECT EXISTS (...)

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread Michael Bayer
Here's a test which generates essentially the same form and runs fine, I'll try to simulate more of exactly what you're doing. Or if you had a real test case ready to go, would save me a ton of time. from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread Michael Bayer
OK it's another limit + joinedload - subquery targeting issue, so this is http://www.sqlalchemy.org/trac/ticket/2419 and workaround for now is use subqueryload_all() instead of joinedload_all() for this specific query. On Feb 28, 2012, at 11:43 AM, Michael Bayer wrote: Here's a test

Re: [sqlalchemy] Column anon_1.anon_2 is generated in a select statement

2012-02-28 Thread naktinis
Cool! Thanks so much! I'll give the workaround a try. Yes, now I see - anon_2 was a column name, not a table name. On Tuesday, February 28, 2012 6:54:42 PM UTC+2, Michael Bayer wrote: OK it's another limit + joinedload - subquery targeting issue, so this is

[sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Kent
Is there a simple way to revert all columns back to their committed state (some columns may be synonyms), or do I need to loop through mapper.iterate_properties, get the ColumnProperty ones, make sure they aren't aliases (prop.columns[0] is Column) and use setattr() to set the value back to the

Re: [sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Michael Bayer
If you're trying to avoid doing a SQL round trip then yeah there's no API for a revert within the attribute itself, we tried going down that road when we started doing 0.5 and quickly ran into all kinds of edge cases that didn't really work out, so we decided to just keep it simple and let the

Re: [sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Michael Bayer
oh also you might want to use attributes.set_committed_state instead of setattr() so that the history is cleared. On Feb 28, 2012, at 4:08 PM, Kent wrote: Is there a simple way to revert all columns back to their committed state (some columns may be synonyms), or do I need to loop through

[sqlalchemy] Re: most straightforward way to revert some column changes

2012-02-28 Thread Kent
On Feb 28, 5:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: oh also you might want to use attributes.set_committed_state instead of setattr() so that the history is cleared. 1) What do you mean? setattr() also clears the history if you set it back to what it used to be... right? 2)

[sqlalchemy] Introducing SQLAlchemy-ORM-tree: a generic API for hierarchical data

2012-02-28 Thread Mark Friedenbach
I'd like to introduce a package I've been working on for a little while now: SQLAlchemy-ORM-tree, “an implementation for SQLAlchemy- based applications of the nested-sets/modified-pre-order-tree- traversal technique for storing hierarchical data in a relational database.” It's gone through a

Re: [sqlalchemy] Re: most straightforward way to revert some column changes

2012-02-28 Thread Michael Bayer
On Feb 28, 2012, at 6:08 PM, Kent wrote: On Feb 28, 5:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: oh also you might want to use attributes.set_committed_state instead of setattr() so that the history is cleared. 1) What do you mean? setattr() also clears the history if you set