[sqlalchemy] MySql has gone away

2009-04-16 Thread reetesh nigam
Hi All, I was getting My Sql has gone away, then i set sqlalchemy.pool_recylce=3600 in prod.cfg. it was woking fine but but still some time i get the same error i.e MySql has gone away. Can any one tell me what should i do? Thanks anD Regards Reetesh Nigam

[sqlalchemy] Re: using for_update returns stale data if old row already exists in identity_map

2009-04-16 Thread dykang
wow, thanks for the replies. I really appreciate the quick responses. I've been using sqlalchemy for a few years now, and I have been very impressed by the turnaround on questions and bugs when dealing with this group. Again, thank you. I have just a few more (inline) comments below On Apr 15,

[sqlalchemy] Re: using for_update returns stale data if old row already exists in identity_map

2009-04-16 Thread Michael Bayer
On Apr 16, 2009, at 3:25 AM, dykang wrote: Are objects not marked as dirty on changes? Do you check each attribute of each object in the session on every flush? If this process has poor performance, doesn't autoflush suffer the same consequences? I believe I probably overstated

[sqlalchemy] mapping class against multiple databases

2009-04-16 Thread JanW
Hi all, I've playing around with SQLAlchemy for a few months, being very happy with the results. As my adventures are getting gradually more complex I feel I've finally run into a problem where I am just stuck, so any help from the SQLAlchemy community would be greatly appreciated. In essence I

[sqlalchemy] Re: mapping class against multiple databases

2009-04-16 Thread Michael Bayer
that error is just a table already exists. pass checkfirst=True to your table.create() call. On Apr 16, 2009, at 6:21 AM, JanW wrote: Hi all, I've playing around with SQLAlchemy for a few months, being very happy with the results. As my adventures are getting gradually more complex I

[sqlalchemy] Re: mapping class against multiple databases

2009-04-16 Thread JanW
Oops, yes of course. Sorry, I copied the error message from the wrong terminal. The relevant error message would be this one: Traceback (most recent call last): File demo.py, line 51, in module result = Person.query().all() File /Library/Frameworks/Python.framework/Versions/2.5/lib/

[sqlalchemy] Re: mapping class against multiple databases

2009-04-16 Thread Michael Bayer
if the issue is, youre doing a JOIN across two tables that are in different databases, that's not going to work. you cant issue a JOIN across two different databases unless both of those tables are accessible using schemas or remote database links within the same process. On Apr 16,

[sqlalchemy] Re: mapping class against multiple databases

2009-04-16 Thread JanW
OK, thanks, so does that mean that mapping one class against multiple tables in different databases is something very exotic and probably bad practice? Or is there some elegant way to achieve this? Thanks, Jan. On Apr 16, 4:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: if the issue is,

[sqlalchemy] Re: mapping class against multiple databases

2009-04-16 Thread Michael Bayer
On Apr 16, 2009, at 10:50 AM, JanW wrote: OK, thanks, so does that mean that mapping one class against multiple tables in different databases is something very exotic and probably bad practice? its an impossible practice unless you're using DBLINK... Or is there some elegant way to

[sqlalchemy] Deleting from collection (updating a collection?)

2009-04-16 Thread Marcin Krol
Hello, I've got many to many relation: Reservation to Host. In Reservation I've got collection (apparently an instance of InstrumentedList) of hosts. How can I delete element from that collection? That is, I do not need to delete Host per se, just delete reference to it in Reservation.hosts.

[sqlalchemy] Re: MySql has gone away

2009-04-16 Thread Ritesh Nadhani
Hello Even I am getting the same error. I thought pool_recycle was the option to look into after doing research on Google. For testing, I have a MySQL server with wait_timeout set to 10 seconds. http://paste.pocoo.org/show/112820/ On Wed, Apr 15, 2009 at 11:36 PM, reetesh nigam

[sqlalchemy] How can I get mapped data from an aliased subselect?

2009-04-16 Thread dykang
The following example is very contrived, but it's a very simplified version of what I am actually trying to do. Basically I'm trying to join with a derived table, that itself is a self join. Can someone help me figure out what I am doing wrong with this example? Thanks #create meta #create

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread Michael Bayer
On Apr 16, 2009, at 2:31 PM, dykang wrote: inside = table.alias('inside') outside = inside.join(table, table.c.foo 2) s = outside.select(use_labels=True).alias('outside') j = table2.join(s, table2.c.bar == outside.c.inside_foo) s = j.select(use_labels=True) rows =

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread dykang
So above, you're joining table2 to s.  the ON clause must be in   terms of table2 and s, not outside, which is meaningless in that   context. You are correct, that was a mistake in my example, but does not change my mapping error. The error was not that the query it was creating was

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread Michael Bayer
the error youre showing me, which is sqlalchemy.exc.OperationalError: (OperationalError) (1054, Unknown column 'inside.foo' in 'on clause') , has nothing to do with mapping. the SQL is not being understood by the database. from_statement() results in the SQL you pass being executed

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread dykang
oh, haha, sorry. i've been staring at this too long. the real error (the one that I do get when I fix the example) is sqlalchemy.exc.NoSuchColumnError: Could not locate column in row for column 'inside.id' they looked very similar, and i didn't look close enough. sorry On Apr 16, 12:27 pm,

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread Michael Bayer
the sophisticated column correlation you're looking for will only work if you use query.select_from(s), in which case there's no point in creating the final subquery, just call select_from(j) to prevent an unnecessary layer of nesting. It also seems like your ultimate query is better

[sqlalchemy] Attempting to flush an item of type...

2009-04-16 Thread Alessandro Dentella
Hi, I have a structure as this: fossati setup (module with attribute USER) models/cliente(User) calendar (Entry) apps/job in calendar.py: from cliente import User class Entry(Base): ... user = relation(User,

[sqlalchemy] Re: How can I get mapped data from an aliased subselect?

2009-04-16 Thread dykang
thanks again for your help. I was curious though, I don't really understand what select_from is doing, and why it is able to map this data. I couldn't really find good explanations in the documentation about this. is there a good place for me to look to understand what this is doing? My