[sqlalchemy] SQLAlchemy and SQLRelay

2008-01-14 Thread Andrew Stromnov
Is it possible to use SA with SQLRelay? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to

[sqlalchemy] Re: SQLAlchemy and SQLRelay

2008-01-14 Thread Alexandre da Silva
Is it possible to use SA with SQLRelay? I Think yes if you are using MySQL or PostgreSQL, they have a Client Native API Wrapper, so you can try it. For others, I suggest the SA Core team to write the driver fot that client API, because it can be very useful in many cases. Att -- Alexandre

[sqlalchemy] MapperExtension.after_update and Session.merge(..., dont_load=True).

2008-01-14 Thread klaus
Hi all, sometime since version 0.4.2, the after_update hook of a MapperExtension fires even if no SQL UPDATE statement is generated. Is this a bug or a feature? In my case, an object is marked as dirty because a backref has changed, not because of any change in the object itself. A merge(...,

[sqlalchemy] Attaching a 'pre-created' class to a session?

2008-01-14 Thread Paul-Michael Agapow
It seems there must be something I'm missing here, so hopefully other sets of eyes will spot an obvious mistake. I have a series of objects that may-or-may not be persistent: some will be created and stored to a db, some will be retrieved from the db, maybe modified and updated, others

[sqlalchemy] problems with filter_by()

2008-01-14 Thread maxi
Hi, I recently upgrade from sqlalchemy 0.3.10 to 0.4.2p3. I have a method like this: def getPlanillaDet(self, plan_id): return session.query(PlanillaDet).filter_by(Planilladet.c.plan_id==plan_id).all() Now, after update, when I try to execute this method, I get an exception with the

[sqlalchemy] Re: MapperExtension.after_update and Session.merge(..., dont_load=True).

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 5:30 AM, klaus wrote: Hi all, sometime since version 0.4.2, the after_update hook of a MapperExtension fires even if no SQL UPDATE statement is generated. Is this a bug or a feature? this is a feature, the save_obj() method is including your object but no UPDATE is

[sqlalchemy] Re: problems with filter_by()

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 9:38 AM, maxi wrote: Hi, I recently upgrade from sqlalchemy 0.3.10 to 0.4.2p3. I have a method like this: def getPlanillaDet(self, plan_id): return session .query(PlanillaDet).filter_by(Planilladet.c.plan_id==plan_id).all() Now, after update, when I try to

[sqlalchemy] Re: problems with filter_by()

2008-01-14 Thread maxi
Thaks for your help. Can you post an example over how to use filter and filter_by in new sqlalchemy versions? Is your recommendation included in 0.3 to 0.4 migration guide? Why this change? Regards. --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote: Michael Bayer wrote: I came up with a very easy way to implement this which I'd like you to try out in rev 4060. So far I've tested with a basic joined table inheritance setup. All you do is place class-mapped attributes

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 8:41 AM, svilen wrote: i have, say, base class A, inherited by two children B and C. B has an attribute/relation 'address', A and C do not have it. So i had a query(A).eagerload( 'address') and that did work before r3912. But later it gives an error - mapper|A has no

[sqlalchemy] Query object behavior for methods all() and one()

2008-01-14 Thread Adrian
I am a bit confused by the behavior for the methods all() and one() if the Query would return an empty result set. In the case of all() it returns an empty list whereas one() will throw an exception (sqlalchemy.exceptions.InvalidRequestError). I am sure there was a reason to implement as it is

[sqlalchemy] Re: Query object behavior for methods all() and one()

2008-01-14 Thread svilen
all() returns whatwever is there, 0, 1, n first() returns first if any or None one() asserts there's exactly 1 On Monday 14 January 2008 18:23:28 Adrian wrote: I am a bit confused by the behavior for the methods all() and one() if the Query would return an empty result set. In the case of

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-14 Thread svilen
On Monday 14 January 2008 17:19:14 Michael Bayer wrote: On Jan 14, 2008, at 8:41 AM, svilen wrote: i have, say, base class A, inherited by two children B and C. B has an attribute/relation 'address', A and C do not have it. So i had a query(A).eagerload( 'address') and that did work

[sqlalchemy] Re: Query object behavior for methods all() and one()

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 11:23 AM, Adrian wrote: I am a bit confused by the behavior for the methods all() and one() if the Query would return an empty result set. In the case of all() it returns an empty list whereas one() will throw an exception (sqlalchemy.exceptions.InvalidRequestError). I

[sqlalchemy] Re: eagerloading polymorphic mapper

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 11:29 AM, svilen wrote: On Monday 14 January 2008 17:19:14 Michael Bayer wrote: On Jan 14, 2008, at 8:41 AM, svilen wrote: i have, say, base class A, inherited by two children B and C. B has an attribute/relation 'address', A and C do not have it. So i had a

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote: model.Media.query.join([catalog, model .CatalogChannel .channel ]).filter (model.CatalogChannel.c.id_channel==c.playlist.id_channel).all() is CatalogChannel.channel a self referential relation to another Channel ? the classes you

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 12:04 PM, Michael Bayer wrote: On Jan 14, 2008, at 11:59 AM, Michael Bayer wrote: On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote: model.Media.query.join([catalog, model .CatalogChannel .channel ]).filter

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Alexandre Conrad
Mike, Michael Bayer wrote: a certain id_channel. otherwise im still having trouble wrapping my head around what youre trying to do there. Enough guessing, here's the full test case with description of what I'm trying to do. :) Although, I wasn't able to make it run with sqlite, so it's

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 12:12 PM, Alexandre Conrad wrote: Mike, Michael Bayer wrote: a certain id_channel. otherwise im still having trouble wrapping my head around what youre trying to do there. Enough guessing, here's the full test case with description of what I'm trying to do. :)

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 11:59 AM, Michael Bayer wrote: On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote: model.Media.query.join([catalog, model .CatalogChannel .channel ]).filter (model.CatalogChannel.c.id_channel==c.playlist.id_channel).all() like, are you sure you dont want to

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Alexandre Conrad
Alexandre Conrad wrote: under a foo table with MySQL. (another hidden bug, I'm getting a foo schema/db, not table. -- Alexandre CONRAD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote: model.Media.query.join([catalog, model .CatalogChannel .channel ]).filter (model.CatalogChannel.c.id_channel==c.playlist.id_channel).all() like, are you sure you dont want to just say: model .Media .query .join ([catalog ]).filter

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Alexandre Conrad
Michael Bayer wrote: thats not hidden. SQLite cannot autoincrement primary key columns if the table contains a composite primary key which is the case here. Ah, yes. Plus, I don't need composite primary_key here, it's articact from an old many-to-many secondary table (which I usually set

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 12:12 PM, Alexandre Conrad wrote: Mike, Michael Bayer wrote: a certain id_channel. otherwise im still having trouble wrapping my head around what youre trying to do there. Enough guessing, here's the full test case with description of what I'm trying to do. :)

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Alexandre Conrad
Michael Bayer wrote: your best bet with this mapping right now is: print Media .query .select_from (media_table .join (catalog_table ).join (catalog_channel_table )).filter(CatalogChannel.c.id_channel==playlist.id_channel).all() which is really how select_from() was

[sqlalchemy] Re: MapperExtension.after_update and Session.merge(..., dont_load=True).

2008-01-14 Thread klaus
Nice, thanks! On 14 Jan., 16:16, Michael Bayer [EMAIL PROTECTED] wrote: On Jan 14, 2008, at 5:30 AM, klaus wrote: Hi all, sometime since version 0.4.2, the after_update hook of a MapperExtension fires even if no SQL UPDATE statement is generated. Is this a bug or a feature? this is

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 12:12 PM, Alexandre Conrad wrote: Mike, Michael Bayer wrote: a certain id_channel. otherwise im still having trouble wrapping my head around what youre trying to do there. Enough guessing, here's the full test case with description of what I'm trying to do. :)

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Alexandre Conrad
Mike, My day is over, I'm leaving the office. I'll read your replies tomorrow. Thanks for taking some time one that. Regards, -- Alexandre CONRAD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: filter() on inherited class doesn't point to the correct table

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 12:44 PM, Alexandre Conrad wrote: Michael Bayer wrote: your best bet with this mapping right now is: print Media .query .select_from (media_table .join (catalog_table ).join (catalog_channel_table

[sqlalchemy] Re: MapperExtension upgrade

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 1:46 PM, maxi wrote: Hi, In new sqlalchemy version (0.4), the MapperExtension must return EXT_CONTINUE for each method. Now, all methods must return this const? For instance, I've the next extension for my mapper: class ConvenioExtension(MapperExtension): def

[sqlalchemy] MapperExtension upgrade

2008-01-14 Thread maxi
Hi, In new sqlalchemy version (0.4), the MapperExtension must return EXT_CONTINUE for each method. Now, all methods must return this const? For instance, I've the next extension for my mapper: class ConvenioExtension(MapperExtension): def create_instance(self, mapper, selectcontext, row,

[sqlalchemy] InvalidRequestError when I try to save object

2008-01-14 Thread maxi
Hi, Follwing with my 0.3 to 0.4 upgrade, now I get the next problem... When I try to save an object across my session, I get an InvalidRequestError exception with the message: File c:\programs\python25\lib\site-packages\sqlalchemy-0.4.2p3- py2.5.egg\sqlalchemy\orm\session.py, line 988, in

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 2:32 PM, maxi wrote: Hi, Follwing with my 0.3 to 0.4 upgrade, now I get the next problem... When I try to save an object across my session, I get an InvalidRequestError exception with the message: File c:\programs\python25\lib\site-packages\sqlalchemy-0.4.2p3-

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread maxi
I must use save_update alone or save_update + flush ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this

[sqlalchemy] Re: mssql connection uri

2008-01-14 Thread Rick Morrison
The mssql URI is going to take the same conceptual form as any other sqlalchemry dburi. The format is documented and available in the SA docs. We can't give you the exact URI, because it's going to contain things that are specific to your application, like database name, password, etc. ODBC under

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread Rick Morrison
flush() works exactly as before. the difference that Mike is pointing out is that 0.3 allowed already-persisted objects to be re-added, which was a bug that is now fixed. Using save_or_update() instead of save() will help you avoid triggering the error when the object you're trying to .save() is

[sqlalchemy] mssql connection uri

2008-01-14 Thread Lukasz Szybalski
Hello, I need to extend my turbogears app to get some records from ms sql. Do you guys know how to setup the ms sql dbi uri to work with sqlalchemy? What connection uri do I use? How do I setup unix odbc for it? Anything else I need? Can you give me exact instructions? Thanks, Lucas --

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread maxi
But, is my design mistake ? I must use ever save_or_update() function? In my case, I have two process working over the same class of bussines object. I do a query, which return me an object list and I call to other function which pass one parameter (id) and this function do other query over the

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread Rick Morrison
Well, the my_service.get_people() most likely uses a query to retrieve those people from the database, right? That query would have the effect of putting those results into the session as persistent objects. When you call session.save() on one of those already-persisted objects, the session checks

[sqlalchemy] SqlAlchemy 0.4 and py2exe. Problem solved?

2008-01-14 Thread maxi
Is solved the problem involved in py2exe and sqlalchemy 0.3 ? Can I use py2exe without problem with loggin module? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] Re: Exclude Autogenerated Timestamp Column

2008-01-14 Thread Dean Halford
Good points - although restructuring the database around integer PKs is out of the question at the moment and we also need to support operations where 'road shoot' databases are merged into our master database... so we do have one legitimate use for GUIDs :) If I run across a way to fetch

[sqlalchemy] Large eager fetches not so eager?

2008-01-14 Thread Rick Morrison
This is going to sound kind of strange, but I've noticed that sometimes when doing fairly large eager loads, that not everything always loads. So running, say custlist = S.query(Customer).options(eagerload('addresses'), eagerload('properties')).filter(Customer.id.in_([...])).all() and fetching

[sqlalchemy] Re: Large eager fetches not so eager?

2008-01-14 Thread Rick Morrison
Update: it's not the length of the fetch, a smaller fetch still has holes it it. Looks as if something might be short-circuiting the SA internal join? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Large eager fetches not so eager?

2008-01-14 Thread Michael Bayer
On Jan 14, 2008, at 8:11 PM, Rick Morrison wrote: This is going to sound kind of strange, but I've noticed that sometimes when doing fairly large eager loads, that not everything always loads. So running, say custlist = S.query(Customer).options(eagerload('addresses'),

[sqlalchemy] Re: Large eager fetches not so eager?

2008-01-14 Thread Rick Morrison
I had already put together a short test case which as usual is of course working fine, but it's greatly simpler than the in-application use and uses sqlite instead of MSSQL, so I'll bang on it from time to time as I've got a few seconds and I'll see where it goes. I did notice some behavior that