Re: [sqlalchemy] using an unmapped object to get the mapped object from a session

2013-01-11 Thread Chris Withers
On 10/01/2013 23:52, Michael Bayer wrote: On Jan 10, 2013, at 3:35 AM, Chris Withers wrote: Hi All, If I have an unmapped object which has had some attributes set on it, what would be the best way to use that object to load a mapped object? I didn't noticed a session.lookup(myobj) method

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread YKdvd
That sounds even nicer, and since I'm just starting out with no legacy code I've been meaning to try dropping 0.8 in even before it is final. It sounds like I could just do something like event.listen(MyDeclarativeSubclass, load, myStamperFunc). I popped in 0.8b2 and tried something

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 10:19 AM, YKdvd wrote: That sounds even nicer, and since I'm just starting out with no legacy code I've been meaning to try dropping 0.8 in even before it is final. It sounds like I could just do something like event.listen(MyDeclarativeSubclass, load, myStamperFunc).

Re: [sqlalchemy] using an unmapped object to get the mapped object from a session

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 2:17 AM, Chris Withers wrote: On 10/01/2013 23:52, Michael Bayer wrote: On Jan 10, 2013, at 3:35 AM, Chris Withers wrote: Hi All, If I have an unmapped object which has had some attributes set on it, what would be the best way to use that object to load a mapped

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-11 Thread Michael Bayer
there's no class level GC cycle when dealing with the Session object, no, this bug is local to the ad-hoc subclass mechanism of sessionmaker(). On Jan 11, 2013, at 2:01 AM, Anoop K wrote: OK. So does Session(bind=engine, expire_on_commit=False) usage always guarantee that engine and

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 2:26 AM, YKdvd wrote: On Friday, January 11, 2013 2:34:09 AM UTC-4, Michael Bayer wrote: you can associate the instance event with the mapper() callable or Mapper class, and it will take effect for all mapped classes. I think that would work for my case, although

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread YKdvd
On Friday, January 11, 2013 11:25:06 AM UTC-4, Michael Bayer wrote: in theory. It's new stuff and was very tricky to get it to work, so feel free to send a brief test along. Here's a minimal example I quickly put together - it retrieves from the database, but the handler doesn't seem to

Re: [sqlalchemy] Is MySQL 5.5 supported by SQLAlchemy? (Ubuntu 12.04)

2013-01-11 Thread Mike Bissell
Hi everyone, A few months ago I asked about MySQL 5.5 support. Ubuntu's package manager had upgraded me to MySQL 5.5, but SQLAlchemy's docs state the following: SQLAlchemy supports 6 major MySQL versions: 3.23, 4.0, 4.1, 5.0, 5.1 and 6.0, with capabilities increasing with more modern servers.

Re: [sqlalchemy] Is MySQL 5.5 supported by SQLAlchemy? (Ubuntu 12.04)

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 12:16 PM, Mike Bissell wrote: Hi everyone, A few months ago I asked about MySQL 5.5 support. Ubuntu's package manager had upgraded me to MySQL 5.5, but SQLAlchemy's docs state the following: SQLAlchemy supports 6 major MySQL versions: 3.23, 4.0, 4.1, 5.0, 5.1 and

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 11:35 AM, YKdvd wrote: On Friday, January 11, 2013 11:25:06 AM UTC-4, Michael Bayer wrote: in theory. It's new stuff and was very tricky to get it to work, so feel free to send a brief test along. Here's a minimal example I quickly put together - it retrieves from

Re: [sqlalchemy] setting use_labels=True for ORM generated selects?

2013-01-11 Thread Bill Curtis
I created a runnable .py while that mimicked the tables and models as closely as possible using a SQLite in-memory engine, but aggravatingly, I can't reproduce the problem with it. I discovered that the problem goes away when you set echo=True in engine_from_config, the problem goes away, so my

Re: [sqlalchemy] setting use_labels=True for ORM generated selects?

2013-01-11 Thread Michael Bayer
if echo=True is affecting it that usually refers to an issue that is triggered by hash ordering, which is non-deterministic. I've observed that printing to standard out often has some correlation with hash ordering going in one direction or the other. Seems like you've definitely hit some

Re: [sqlalchemy] using an unmapped object to get the mapped object from a session

2013-01-11 Thread Chris Withers
On 11/01/2013 15:26, Michael Bayer wrote: what is it looking up ?what's a myobj ? An unmapped instance of the mapped class. yeah you don't want to have unmapped instances of mapped classes lying around. Why? They're just objects. It's really handy having domain objects that can

Re: [sqlalchemy] setting use_labels=True for ORM generated selects?

2013-01-11 Thread Bill Curtis
I will continue to poke at it time permitting, and let you know if I figure anything out, and/or if it goes away under 0.8. thanks again. On Fri, Jan 11, 2013 at 11:30 AM, Michael Bayer mike...@zzzcomputing.comwrote: if echo=True is affecting it that usually refers to an issue that is

Re: [sqlalchemy] using an unmapped object to get the mapped object from a session

2013-01-11 Thread Chris Withers
On 11/01/2013 20:01, Michael Bayer wrote: On Jan 11, 2013, at 1:37 PM, Chris Withers wrote: On 11/01/2013 15:26, Michael Bayer wrote: what is it looking up ?what's a myobj ? An unmapped instance of the mapped class. yeah you don't want to have unmapped instances of mapped classes

[sqlalchemy] SOME/ANY/ALL in postgres?

2013-01-11 Thread Ryan Kelly
I'm trying to figure out the correct way to use these array comparisons features specific to postgres, e.g.: select * from foo where 1 = any(bar); So I tried this: from sqlalchemy.sql.expression import func session.query(foo).filter(1 == func.any(foo.c.bar)) But that didn't work, as I got this

Re: [sqlalchemy] using an unmapped object to get the mapped object from a session

2013-01-11 Thread Robert Forkel
Transient Am 11.01.2013 22:33 schrieb Chris Withers ch...@simplistix.co.uk: On 11/01/2013 20:01, Michael Bayer wrote: On Jan 11, 2013, at 1:37 PM, Chris Withers wrote: On 11/01/2013 15:26, Michael Bayer wrote: what is it looking up ?what's a myobj ? An unmapped instance of the

[sqlalchemy] How to label const in select statement?

2013-01-11 Thread limodou
I have a select just like : select([User, 0]) and I don't know how to label 0 as real sql statement like this: select User.*, 0 as age; How to do that with label? Thanks. -- I like python! UliPad The Python Editor: http://code.google.com/p/ulipad/ UliWeb simple web framework: