[sqlalchemy] Re: joining to inherited table

2010-12-23 Thread kindly
t is. It will be fine for now. On Dec 24, 1:53 am, Michael Bayer wrote: > On Dec 23, 2010, at 8:38 PM, kindly wrote: > > > > > Hello > > > Is there a nice way to get the subquery object that relates to anon_1 > > in the below case so you can use it to filter on? >

[sqlalchemy] joining to inherited table

2010-12-23 Thread kindly
Hello Is there a nice way to get the subquery object that relates to anon_1 in the below case so you can use it to filter on? You can get it by q._joinpoint['_joinpoint_entity'] but that is clearly private. Thanks David class Employee(object):pass class Manager(Employee):pass class

[sqlalchemy] Re: no cascades on mapper?

2010-09-29 Thread kindly
ve and pathologically "add"ing will do the trick. On Sep 29, 12:20 am, Michael Bayer wrote: > On Sep 28, 2010, at 6:32 PM, kindly wrote: > > > I have been doing some profiling on a batch job I have been running. > > > I control all my own cascading,

[sqlalchemy] no cascades on mapper?

2010-09-28 Thread kindly
I have been doing some profiling on a batch job I have been running. I control all my own cascading, so I set the cascade flag on each relation to "none". Even so mapper.cascade_iterator does quite a lot of work. I did the crudest test by just placing a return at the top of cascade_iterator. It

[sqlalchemy] Re: SQLAlchemy 0.6.3 released

2010-07-15 Thread kindly
Thanks for doing 1853 so quickly. On Jul 15, 5:57 pm, Michael Bayer wrote: > hello again ! > > Just a week and a half ago, we put out version 0.6.2.   Wouldn't you know it, > the very next day someone came along and reported an issue that wasn't hard > to fix but I felt really, really had to go

[sqlalchemy] Re: extra where on orm updates with error checking

2009-11-29 Thread kindly
Perfect. I really thought I had read all the documentation. Thanks again. On 28 Nov, 18:45, Michael Bayer wrote: > On Nov 28, 2009, at 10:25 AM, kindly wrote: > > > > > Is there a way of, with every orm update to add extra conditions to > > the where clause and to che

[sqlalchemy] extra where on orm updates with error checking

2009-11-28 Thread kindly
Is there a way of, with every orm update to add extra conditions to the where clause and to check (and rollback if fail) that the row that was supposed to be updated actually was. i.e user = session.query(User).get(4) ## id of 4 user.name = "fred" ## a change to user name session.add(user) sess

[sqlalchemy] Could someone look over this diff for update to the version recipe.

2009-08-25 Thread kindly
Hello, The version recipe on the wiki will version if the object is dirty, but I thought it would be more useful if it did it only when there was an actual change. The diff is below, added a test too, and I would be happy to upload it after someone looks over it? The recipe is at http://www.sq

[sqlalchemy] Re: how to transaction like this

2009-05-20 Thread kindly
Instead of the first commit use flush. You have already committed so you cant roll back. so session.begin() try: p=parent() session.add(p) session.flush() c=child() c.p_id=p.id session.add(c) session.commit() except: session.rollback() On May 20, 11:31 am, manm

[sqlalchemy] Re: using relation in non-declarative table and class definitions (newbie problem)

2009-02-25 Thread kindly
You add the relation to the propoties on mapper. Look at http://www.sqlalchemy.org/docs/05/mappers.html#basic-relational-patterns On Feb 24, 4:10 pm, Marcin Krol wrote: > Hello everyone, > > I've been following > tutorialhttp://www.sqlalchemy.org/docs/05/ormtutorial.htmlwhich explains how >

[sqlalchemy] Re: is _sa_instance_state.get_history stable to use?

2009-02-24 Thread kindly
lled. > > On Feb 23, 2009, at 5:16 PM, Michael Bayer wrote: > > > > > there is not, you'd have to do something along the lines of: > > >   for prop in local_mapper.iterate_properties: > >         getattr(local_mapper.class_, prop.key).impl.active_history = >

[sqlalchemy] Re: is _sa_instance_state.get_history stable to use?

2009-02-24 Thread kindly
lled. > > On Feb 23, 2009, at 5:16 PM, Michael Bayer wrote: > > > > > there is not, you'd have to do something along the lines of: > > >   for prop in local_mapper.iterate_properties: > >         getattr(local_mapper.class_, prop.key).impl.active_history

[sqlalchemy] Re: is _sa_instance_state.get_history stable to use?

2009-02-24 Thread kindly
lled. > > On Feb 23, 2009, at 5:16 PM, Michael Bayer wrote: > > > > > there is not, you'd have to do something along the lines of: > > >   for prop in local_mapper.iterate_properties: > >         getattr(local_mapper.class_, prop.key).impl.active_history

[sqlalchemy] Re: is _sa_instance_state.get_history stable to use?

2009-02-23 Thread kindly
does and do your history operation inline. > > On Feb 18, 2009, at 9:43 AM, kindly wrote: > > > > > Hello > > > I intend to log any changes (not new rows) to a table. > > > The simplist way I can see to do this is to check every object that is > > "

[sqlalchemy] Re: is _sa_instance_state.get_history stable to use?

2009-02-18 Thread kindly
e latest trunk you can pass "myobject" straight to get_history > without using instance_state. > > session.is_modified() just calls get_history() on every attribute, so > you might want to consider just looping through the attributes the way > is_modfied() does and do your his

[sqlalchemy] is _sa_instance_state.get_history stable to use?

2009-02-18 Thread kindly
Hello I intend to log any changes (not new rows) to a table. The simplist way I can see to do this is to check every object that is "add"ed for changes. I intend to, before every flush, look in "dirty" then use is_modified and if there is a change use get_history to find out the original and ne

[sqlalchemy] Using ORM objects to validate themselfs.

2008-07-12 Thread kindly
I have just started working on "another" kind of declarative layer for SQLalchemy. Infact it is more like a domain specific language for setting up basic form orientated databases for small charities in order to provide viable alternative to Access for simple information storage needs. The detail