[sqlalchemy] Re: pymssql and encoding - I can not get \x92 to be an '

2007-04-11 Thread Rick Morrison
...and while I'm making this thread unnecessarily long, I should add that while pymssql may not understand Unicode data, the pyodbc DB-API interface does. Thanks to recent work by Paul Johnston, it's on fast-track to becoming the preferred MSSQL db-api for SA. On 4/10/07, Rick Morrison [EMAIL

[sqlalchemy] commit happening but, no changes in the database!

2007-04-11 Thread tml
Hi, I have this following code in my Turbogears which implements nested_sets based msgboard. Each post has its own msg board, so instead of locking the msgboard table itself, i lock the parent post's row while editing the msgboard table. msg_parents is the parent table. msg_board is the table

[sqlalchemy] Re: [PATCH] Filtered one_to_many relationships (Experimental)

2007-04-11 Thread Gaetan de Menten
On 4/10/07, Michael Bayer [EMAIL PROTECTED] wrote: hm, why is from_attr a classmethod ? Because that way, you don't have to specify the related class at all, and you can specify the parameters as args not kwargs. See my first initial remark: * I've implemented Query.from_attr, instead of

[sqlalchemy] Re: [PATCH] Filtered one_to_many relationships (Experimental)

2007-04-11 Thread svilen
is from_attr makeing sense for plain atributes, e.g. integers ot whatever? if no, maybe choose something like from_relation or filter_relation or filter_relation_tomany or similar if it is expected to only work over relations - and multiple-instances relations; i.e. it is useless over single

[sqlalchemy] session.expunge() detaches all objects recursively?

2007-04-11 Thread Arun Kumar PG
Hi Guys, not tried but quick answer would help me: session.expunge()'ing an object would also expunge the child attributes which are relations ? e.g. expunging User object would also expunge user_addresses (a list of UserAddress object) ? Also, if I make any modification in the detached

[sqlalchemy] Re: 'PropertyLoader' object has no attribute 'strategy'

2007-04-11 Thread King Simon-NFHD78
Roger Demetrescu wrote: On 4/11/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote: I've got no idea about the source of the problem, but it would probably be helpful if you could provide stack traces from the exceptions, if that's possible. Do you mean using the traceback module ?

[sqlalchemy] Re: [PATCH] Filtered one_to_many relationships (Experimental)

2007-04-11 Thread Gaetan de Menten
On 4/11/07, svilen [EMAIL PROTECTED] wrote: is from_attr makeing sense for plain atributes, e.g. integers ot whatever? You got a point here. It doesn't work (or even make sense) on plain attributes. if no, maybe choose something like from_relation Fine with me. or filter_relation or

[sqlalchemy] Re: 'PropertyLoader' object has no attribute 'strategy'

2007-04-11 Thread Roger Demetrescu
On 4/11/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote: Roger Demetrescu wrote: Do you mean using the traceback module ? I've just searched about it and I guess I should use this: try: # do my stuff except: traceback.print_exc(file=sys.stdout) raise Is this the

[sqlalchemy] Re: ORM dynamic query ?

2007-04-11 Thread Julien Cigar
Do it with a mapping dict, for example: orders = dict ( la_name = la_name.c.name, en_name = en_name.c.name, group = groups.c.name, habitat = q.c.habitats, since = species.c.obs_belgium, georange = species.c.geographic_range,

[sqlalchemy] Bit strange - no expunge required?

2007-04-11 Thread Arun Kumar PG
Hi Guys, I am having two layers in my application: Manager and DAO. DAO deals with ORM and manager simply calls method on DAO. This is what I am doing in manager manager: rs = dao.getResults(params) obj = rs[0] some logic. obj.name = 'some name' dao.Update(obj) The getResults()

[sqlalchemy] Re: pymssql and encoding - I can not get \x92 to be an '

2007-04-11 Thread Rick Morrison
Last I heard, pyodbc was working on any POSIX system that supports odbc (most likely via unixodbc or iodbc) http://sourceforge.net/projects/pyodbc/ -- check out the supported platforms On 4/11/07, Marco Mariani [EMAIL PROTECTED] wrote: Rick Morrison wrote: ...and while I'm making this

[sqlalchemy] Re: session.expunge() detaches all objects recursively?

2007-04-11 Thread Arun Kumar PG
cool. thx Michael! On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 7:27 AM, Arun Kumar PG wrote: Hi Guys, not tried but quick answer would help me: session.expunge()'ing an object would also expunge the child attributes which are relations ? e.g. expunging

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Ants Aasma
On Apr 11, 6:05 pm, Rick Morrison [EMAIL PROTECTED] wrote: Most of the way it works is great: col.in_(v1, v2, v2) COL IN (v1, v2, v3) col.in_(v1) COL = v1 but this one: col.in_() COL IS NULL is a mapping I don't think is right. In our case, it caused an unexpected

[sqlalchemy] Re: 'PropertyLoader' object has no attribute 'strategy'

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 1:46 AM, Roger Demetrescu wrote: Hi all, I have a daemon with 2 threads to control upload / download of some files (they use SQLAlchemy to find out which files must be worked). Once a week, my daemon's logging system sends me an email with this message:

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 11:05 AM, Rick Morrison wrote: So I was up until 2:30am last night chasing down what looked like a huge memory leak in our app, and it turned out to be what I think is a bug in the way that SA maps the in_() function to SQL syntax. Most of the way it works is great:

[sqlalchemy] Re: ORM dynamic query ?

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 9:56 AM, Arun Kumar PG wrote: Guys, I have a search form and I want to compose the select_by() query dynamically as per the prameters but the select_by() on query object does not accepts string type query i.e. session.query (User).select_by( User.c.Id == 1 and

[sqlalchemy] Re: Bit strange - no expunge required?

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 11:45 AM, Arun Kumar PG wrote: Hi Guys, I am having two layers in my application: Manager and DAO. DAO deals with ORM and manager simply calls method on DAO. This is what I am doing in manager manager: rs = dao.getResults (params) obj = rs[0] some logic.

[sqlalchemy] Re: commit happening but, no changes in the database!

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 3:05 AM, tml wrote: c = session.connect(None) t = c.begin() # Execute the insert on the msg_board_data table with lock held on parent table's row l = metadata.engine.text(SELECT id from %(parenttable)s ...

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 3:22 PM, Ants Aasma wrote: I'd say this is a definite bug. The semantics of col.in_(list) should be column value equals any of the values in the list. For an empty list it should be a constant false, because no value exists in an empty list, not even an missing value

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Michael Bayer
i vote no interpretation at all...if you want IN with one element, thats what youll get. no elements, ditto. also the bind param + etc ticket is #476. its got svilens artwork attached to it which i'd like to refine into a patch + unit test (but without the vis4check module/visitor

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Ants Aasma
On Apr 11, 11:55 pm, Michael Bayer [EMAIL PROTECTED] wrote: but why dont we want to just have it compile just as it says - to IN () on the database side ? im not sure if trying to guess what the user means here is the best approach (refuse the temptation to guess...) Because that is not

[sqlalchemy] Re: IN() bug bit hard

2007-04-11 Thread Michael Bayer
On Apr 11, 2007, at 6:13 PM, Ants Aasma wrote: b) produce IN () SQL + 1:1 mapping between python and sql - most databases will give obscure errors, possibly far away from source of error well i dont think it would be a hard error to track down. the ORM doesnt use in_() so if an in_()

[sqlalchemy] firebird engine patch for type_conv

2007-04-11 Thread bkc
patch against rev 2497 I believe type_conv only allows numeric values, so any type_conv opt passed has to be converted to an int. I bet the same rule applies to concurrency_level, but this patch doesn't address that. (sorry, using google groups I can't see how to attach this as a file) Index:

[sqlalchemy] Re: ORM dynamic query ?

2007-04-11 Thread Arun Kumar PG
Thx Michael. this looks better but can't I do a join here and specify absolute column names like {User.c.UserId..} session.query(User).select_by(**{id: 1, foo : bar}) thx - A On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 9:56 AM, Arun Kumar PG wrote: Guys, I

[sqlalchemy] Re: Bit strange - no expunge required?

2007-04-11 Thread Arun Kumar PG
Hi Michael, So how can I prevent this as I can't access the lazyload attributes in my manager class once I get the result set from DAO as i get no parent session/contextual session exists exception. should I maintain a reference to the session object in the DAO class so that it is not garbage