[sqlalchemy] Re: save_or_update and composit Primary Keys... MSSQL / pyodbc issue ?

2007-12-10 Thread Smoke
On 10 Dic, 03:11, Michael Bayer [EMAIL PROTECTED] wrote: I cant reproduce your problem, although i dont have access to MSSQL here and there may be some issue on that end. Attached is your script using an in-memory sqlite database, with the update inside of a while loop, and it updates

[sqlalchemy] Re: Design: mapped objects everywhere?

2007-12-10 Thread Paul-Michael Agapow
Yowser. Thanks to both of you - that's exactly what I mean. Any pointers on where I can find an example of a class that is unaware if it is in the db? Or is there a good example of the second solution, of a single class that does the what and why, and an interchangeable layer/context

[sqlalchemy] Re: Design: mapped objects everywhere?

2007-12-10 Thread svilen
On Monday 10 December 2007 12:12:19 Paul-Michael Agapow wrote: Yowser. Thanks to both of you - that's exactly what I mean. Any pointers on where I can find an example of a class that is unaware if it is in the db? Or is there a good example of the second solution, of a single class that does

[sqlalchemy] SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti
Foreword: sqlalchemy is really amazing! Hello, I'm trying to build a database where users become aware of what has been changed by other users: there is a SessionExtension that collects info about changes and then dispatch some messages with a Pyro Event Server. I'm trying to understand what

[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti
The only correct link I found it in an obscure (to me) _SessionTransaction__parent, so I suspect this is not the correct way to get to my goal. Is there a cleaner way to do such a thing? Just one thing: I know the syntax _class__attribute to access hidden python attirbutes, obscure is the

[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Marco Mariani
Stefano Bartaletti wrote: I need to gather IDs in after_commit because theID is a serial Postgres value that is available only after flush() Not really... in postgres, you can ask to consume the next sequence value with SELECT NEXTVAL('sequence_name') and explicitly set that as primary

[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti
Alle lunedì 10 dicembre 2007, Marco Mariani ha scritto: Stefano Bartaletti wrote: I need to gather IDs in after_commit because theID is a serial Postgres value that is available only after flush() Not really... in postgres, you can ask to consume the next sequence value with SELECT

[sqlalchemy] Re: Possible to build a query object from a relation property?

2007-12-10 Thread Allen Bierbaum
Thanks. This looks like it should work. I will give it a try. -Allen On Dec 9, 2007 10:39 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Dec 9, 2007, at 10:55 PM, Allen Bierbaum wrote: I am using SA 0.3.11 and I would like to know if there is a way to get a query object from a

[sqlalchemy] Question about using python expressions to create a GIS query

2007-12-10 Thread Allen Bierbaum
I am trying to figure out how to best use SA to create a GIS query. In my application I am actually using ORM objects and mappers, but to keep my question focused on clauses and python expressions, I am just trying to test this out without the ORM first. The SQL query I would like to generate is

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Adam B
On Dec 10, 1:16 am, Rick Morrison [EMAIL PROTECTED] wrote: Any query using sql expressions is going to want to use correctly typed data -- you're trying to query a date column with a string value. The LIKE operator is for string data. I'm not up on my mssql date expressions, but the answer

[sqlalchemy] Re: Slow relation based assignment.

2007-12-10 Thread Martin Pengelly-Phillips
hey mike, Just to confirm - trunk fixes problem with deletion. Additionally, I have removed the lazy loading condition and it maintains the speed of the query. Thanks again to the team, Martin On Dec 7, 4:14 pm, Michael Bayer [EMAIL PROTECTED] wrote: hey martin - this bug is fixed in

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Adam B
On Dec 10, 1:16 am, Rick Morrison [EMAIL PROTECTED] wrote: Any query using sql expressions is going to want to use correctly typed data -- you're trying to query a date column with a string value. The LIKE operator is for string data. I'm not up on my mssql date expressions, but the answer

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Rick Morrison
Yeah, it was a for instance answer, you'll need to use the correct MySql syntax of course. On 12/10/07, Adam B [EMAIL PROTECTED] wrote: On Dec 10, 1:16 am, Rick Morrison [EMAIL PROTECTED] wrote: Any query using sql expressions is going to want to use correctly typed data -- you're trying

[sqlalchemy] Re: save_or_update and composit Primary Keys... MSSQL / pyodbc issue ?

2007-12-10 Thread Rick Morrison
This works here on MSSQL/pymssql with a small change: -- j = Job(TEST1, datetime.datetime.now()) ++ j = Job(1, datetime.datetime.now()) MSSQL (and most other db engines) are going to enforce type on the 'identifier' column. In the new code, it's an int, so...no strings allowed. The original

[sqlalchemy] Re: From arbitrary SELECT to Query

2007-12-10 Thread Michael Bayer
On Dec 7, 2007, at 2:39 PM, Artur Siekielski wrote: The problem is that I get normal Python list, which eats much resources when database is big. Much better would be Query object which supports lazy loading. Note that I cannot use Query.filter(compoundSelect._whereclause) because

[sqlalchemy] Re: Lazy ID Fetching/generation

2007-12-10 Thread Adam Batkin
Rick Morrison wrote: Wouldn't a flavor of .save() that always flush()'ed work for this case? say, Session.persist(obj) Which would then chase down the relational references and persist the object graph of that object...and then add the now-persisted object to the identity map.

[sqlalchemy] Re: Lazy ID Fetching/generation

2007-12-10 Thread Rick Morrison
But another thing, is that the whole idea of save/update/save-or- update, which we obviously got from hibernate, is something ive been considering ditching, in favor of something more oriented towards a container like add(). since i think even hibernate's original idea of save/update has

[sqlalchemy] Re: save_or_update and composit Primary Keys... MSSQL / pyodbc issue ?

2007-12-10 Thread Rick Morrison
I did not get any exception... doh! :) What kind of exception did you get? The traceback I get is below. If you're not getting one, it may be a pyodbc issue, which I don't have installed right now. /me faces toward UK, where it's about midnight right now... /me yells HEY PAUL!! YOU WATCHING

[sqlalchemy] Re: save_or_update and composit Primary Keys... MSSQL / pyodbc issue ?

2007-12-10 Thread Paul Johnston
Hi, /me faces toward UK, where it's about midnight right now... /me yells HEY PAUL!! YOU WATCHING THIS THREAD?? Ok, you got my attention :-) Not at my best right now after being out drinking, but hey... After a little tweak to the code (removing autoload=True, adding metadata.create_all()

[sqlalchemy] Re: concurent modification

2007-12-10 Thread imgrey
Thanks a lot, seems I've managed resolve problem with concurrent modifications by commit(), clear() and close() at each thread, but stuck with another one: Exception in thread Thread-62: Traceback (most recent call last): File threading.py, line 442, in __bootstrap self.run() File