[sqlalchemy] Two enhancement proposals for orm.Query

2009-06-17 Thread klaus
it be difficult to make something like session.query(B).join(ref, backward=True) work? Best regards, Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] orm.Query: Is there a way to build joins using relations only?

2009-05-30 Thread klaus
Let's assume there is a foreign key A.fk - B.id from table A to table B, and these tables and columns are mapped to corresponding classes. Then let's translate the foreign key to a reference A.ref - B via a relation. We can easily join B onto A: session.query(A).join(ref) or

[sqlalchemy] Re: Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-20 Thread klaus
OMG, I didn't read the second sentence on the page. Sorry for that. Klaus On 19 Mai, 19:21, Michael Bayer mike...@zzzcomputing.com wrote: log in as guest/guest On May 19, 2009, at 11:52 AM, klaus wrote: How do I get the privileges for that? On 19 Mai, 17:33, Michael Bayer mike

[sqlalchemy] Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-19 Thread klaus
has no attribute '_sa_instance_state' Cheers Klaus --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-19 Thread klaus
How do I get the privileges for that? On 19 Mai, 17:33, Michael Bayer mike...@zzzcomputing.com wrote: it seems like a small bug and you can file a ticket for that,  but the   intent is that you'd be using None to represent NULL in the general   case. On May 19, 2009, at 11:21 AM, klaus

[sqlalchemy] Possible documentation glitch?

2009-05-11 Thread klaus
Klaus --~--~-~--~~~---~--~~ 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+unsubscr

[sqlalchemy] Re: Tiny feature request (+patch): Adding __len__ to orm.query.Query

2008-03-10 Thread klaus
This seems to become an FAQ. ;-) Klaus On 9 Mrz., 11:34, Thomas Wittek [EMAIL PROTECTED] wrote: On Mar 8, 5:49 pm, Michael Bayer [EMAIL PROTECTED] wrote: __len__() is called first before __iter__() and has the effect of two SQL statements being issued. Actually it seems to be the other

[sqlalchemy] Re: Object state change tracking

2008-02-08 Thread klaus
. Calls to __cleanup show up in all unusual places (when the garbage collector is activated) and take up considerable time. Best regards Klaus On 7 Feb., 16:00, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 7, 2008, at 8:14 AM, klaus wrote: State tracking, the method __cleanup

[sqlalchemy] Re: Readonly objects/protecting objects from modifications

2008-01-18 Thread klaus
prevent changes from being committed to the database. This solution is not very elegant, however. Best regards Klaus On 22 Dez. 2007, 17:03, Michael Bayer [EMAIL PROTECTED] wrote: On Dec 22, 2007, at 12:34 AM, Andreas Jung wrote: --On 21. Dezember 2007 16:33:34 -0500 Michael Bayer [EMAIL

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

2008-01-14 Thread klaus
(..., dont_load=True) is also part of the mix. If it's a bug, I'll try to provide more details. Best regards Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

[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

[sqlalchemy] Re: merge with dont_load=True and lazy relations

2007-11-23 Thread klaus
Fine with me. ;-) Klaus On Nov 23, 6:37 am, Michael Bayer [EMAIL PROTECTED] wrote: Hi there - there are actually two bugs here, the second one is revealed after repairing the first. The first bug is that the merge() dont_load operation was not completing all the necessary housekeeping

[sqlalchemy] Re: AttributeError: 'ColumnProperty' object has no attribute 'strategy'

2007-11-23 Thread klaus
Is it possible that your mapped class has a regular Python property with the same name as a mapped relation? Klaus On 23 Nov., 17:08, lur ibargutxi [EMAIL PROTECTED] wrote: Hi! I made an aplication in my local machine but when I tried to do the same in the server I had this problem

[sqlalchemy] Re: Wrong SQL statement for mapped select involving in_

2007-11-07 Thread klaus
your time. Klaus On 7 Nov., 01:00, Michael Bayer [EMAIL PROTECTED] wrote: I cant reproduce this one. I see you have named bind params so I tried with postgres. it also works with sqlite. works with release 0.4.0 as well as the trunk.output is (with echoing): SELECT testView.id

[sqlalchemy] Re: Wrong SQL statement for mapped select involving in_

2007-11-07 Thread klaus
By the way, on a larger database, drop_all() runs into an endless loop. However, I have no small script to reproduce this yet. Klaus On 7 Nov., 16:39, klaus [EMAIL PROTECTED] wrote: That's very kind. I'm on the trunk (0.4.1dev_r3747) and on linux. And I think your script (with a changed

[sqlalchemy] Re: Wrong SQL statement for mapped select involving in_

2007-11-07 Thread klaus
is that Python (2.5.1 versus the installed 2.4.1) plus the latest psycopg2 does not make a difference. Best regards Klaus On 7 Nov., 16:24, Michael Bayer [EMAIL PROTECTED] wrote: On Nov 7, 2007, at 6:01 AM, klaus wrote: This is strange. I had problems reproducing the bug for a long time

[sqlalchemy] A Query object seems to be altered by a count() - is this a bug?

2007-11-06 Thread klaus
Hi all, when I try to build up a complicated query like this: query = session.query(Class) query = query.filter_by(...).add_entity(...).join(...) count = query.count() query = query.add_entity(...).join(...).order_by(...) print query.all() the last statement fails due to a broken SELECT. The

[sqlalchemy] Re: A Query object seems to be altered by a count() - is this a bug?

2007-11-06 Thread klaus
, binary_alias.fk2) AS squared JOIN unary ON nullary.id = unary.fk \nWHERE %(param_1)s = squared.fk2 AND %(param_1_1)s = squared.fk1 ORDER BY squared.n' {'param_1_1': 1, 'param_1': 1} Best regards Klaus On 6 Nov., 15:40, klaus [EMAIL PROTECTED] wrote: Hi all, when I try to build up a complicated query

[sqlalchemy] Wrong SQL statement for mapped select involving in_

2007-11-06 Thread klaus
, 'test_id_4': 8, 'test_id_5': 10, 'test_id_6': 11, 'test_id_7': 13} Best regards Klaus --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: save/update and caching

2007-11-05 Thread klaus
On 2 Nov., 19:09, Michael Bayer [EMAIL PROTECTED] wrote: On Nov 2, 2007, at 1:15 PM, klaus wrote: Thanks, but this doesn't seem to do what I wanted. The merge modifies the object and therefore tries to update the underlying table on session.flush(). So it might work if you prevented

[sqlalchemy] Re: save/update and caching

2007-11-02 Thread klaus
.) I would prefer a solution, though, that allowed these objects to be immutable like their tables. That is, copy.copy could be used but no constructor and no setattr/delattr (and no remove). My implementation currently catches these with a NotImplementedError. Best regards Klaus On 31 Okt., 18

[sqlalchemy] save/update and caching

2007-10-31 Thread klaus
. Is there a hidden connection between different sessions? I hope you can make sense of these vague description. Best regards Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

[sqlalchemy] Re: Please add some __len__ methods

2007-10-23 Thread klaus
Seems like I am learning more python on this list than I ever wanted... On 22 Okt., 15:37, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 22, 2007, at 6:32 AM, klaus wrote: Hi all, I wonder why some classes/objects implement part of a list interface - but without a __len__ method

[sqlalchemy] Please add some __len__ methods

2007-10-22 Thread klaus
. __len__ could be used to indicate when the session gets too large and should be cleared. I already suggested this some months ago but attracted no attention. ;-) Best regards Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: SQL error for mapped select (new in version 0.4) on PostgreSQL

2007-10-17 Thread klaus
Thanks a lot! The solution is so simple that I feel a little embarassed... On 16 Okt., 18:15, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 16, 2007, at 10:45 AM, klaus wrote: The only thing that I could find out about the reason is that in engine/base.py (1290

[sqlalchemy] Wrong SQL statement for mapped select (versions 0.3.10, 0.3.11 and others)

2007-10-16 Thread klaus
test.id = %(test_id_1)s ORDER BY test.id {'test_id_1': None, 'test_id': 2} The first nested SELECT is wrong: test_id should be 1 and test_id_1 should be 2. The same holds for the third SELECT that tries to follow the foreign key. Therefore, the program prints None 2 None Best regards Klaus

[sqlalchemy] SQL error for mapped select (new in version 0.4) on PostgreSQL

2007-10-16 Thread klaus
The following used to work in SQLAlchemy 0.3: from sqlalchemy import * from sqlalchemy.orm import * metadata = MetaData(...) metadata.bind.echo=True table = Table(test, metadata, Column(id, Integer, primary_key=True), Column(active, Boolean)) table.create()

[sqlalchemy] Re: Wrong SQL statement for mapped select (versions 0.3.10, 0.3.11 and others)

2007-10-16 Thread klaus
Maybe I should add that this bug appears under PostgreSQL and persists in version 0.4. On 16 Okt., 15:50, klaus [EMAIL PROTECTED] wrote: SQLAlchemy generates wrong SELECTs for classes that are mapped to select expressions. Consider the following example: from sqlalchemy import * metadata

[sqlalchemy] Re: postgresql: need schema-qualified foreign keys

2007-07-09 Thread klaus
: On Jul 8, 2007, at 11:38 AM, klaus wrote: (Finally continuing this old thread.) The suggested fix does not seem to work. Here is an example: 1. To build the tables, create a schema test and run the following code: cant reproduce. using trunk, with or without the patch, this script

[sqlalchemy] Re: postgresql: need schema-qualified foreign keys

2007-07-09 Thread klaus
I'm not sure whether I understody your posting correctly. Now I've checked out revision 2867 and nothing has changed, that is, I still get the same exceptions. Best regards Klaus On Jul 9, 9:44 am, klaus [EMAIL PROTECTED] wrote: Oops, obviously I made a mess of my program when pasting

[sqlalchemy] Re: How many objects are in a session

2007-07-07 Thread klaus
And when I am at it (this is going off topic): What do you think about len(query) in addition to or instead of query.count()? IMO, count() is nearly as SQLish als select(). Best regards Klaus On Jul 6, 3:20 pm, klaus [EMAIL PROTECTED] wrote: I noticed that Session has no method len

[sqlalchemy] How many objects are in a session

2007-07-06 Thread klaus
have __len__ too.) Best regards Klaus --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Mapper based on a select generates wrong and unnecessary INSERTs

2007-07-03 Thread klaus
into private attributes (with a leading underscore). BTW, the mapper might want to check that keys are nonempty strings and no two columns are mapped to the same attribute (currently, the last one wins). Best regards Klaus On 2 Jul., 18:12, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 2, 2007

[sqlalchemy] Naming and mapping

2007-06-27 Thread klaus
there be three columns? And where is the prefix s? Best regards Klaus --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: postgresql: need schema-qualified foreign keys

2007-06-19 Thread klaus . barthelmann
This looks like a good solution. I'll need some time to provide a test case, however. If the change breaks existing code, how are cross-schema references supposed to be handled? Best regards Klaus On 18 Jun., 21:54, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 18, 2007, at 4:25 AM, [EMAIL

[sqlalchemy] Re: How to map a Selectable such that objects can be created/inserted, updated, and deleted?

2007-06-18 Thread klaus . barthelmann
, Klaus --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options

[sqlalchemy] Re: How to map a Selectable such that objects can be created/inserted, updated, and deleted?

2007-06-18 Thread klaus . barthelmann
. Any ideas? I'm afraid that this is connected with the VIEWs on the sqlalchemy todo list. Best regards, Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send