Re: [Sqlalchemy-users] BUG: having clause for postgresql

2006-05-04 Thread Michael Bayer
thanks, this is committed in 1392 On May 4, 2006, at 1:07 AM, HD Mail wrote: Hi, "Having" clause needs to be before "Order by" for postgresql. Index: ansisql.py === --- ansisql.py (revision 1387) +++ ansisql.py (working copy)

Re: [Sqlalchemy-users] DateTime as primary key failure

2006-05-04 Thread Michael Bayer
column types were not being bound in the "WHERE" clause of the UPDATE/DELETE generated by mapper, fixed in rev 1389.On May 4, 2006, at 2:25 PM, Dimi Shahbaz wrote:import mx.DateTime as mxDateTime from sqlalchemy import * e = create_engine("postgres://database=test", echo=True) test = Table("test"

Re: [Sqlalchemy-users] select using predefined relationships

2006-05-04 Thread Michael Bayer
select_by should be able to handle going as deep as it goes. You cant put a > in there since select_by is just taking python keyword arguments. We also cant use select(), since that expects the full criterion, i.e. its the generalized case that lets you do anything. so right off thats an

[Sqlalchemy-users] DateTime as primary key failure

2006-05-04 Thread Dimi Shahbaz
Here is a test case that fails with 0.1.6 as well as trunk (http:// svn.sqlalchemy.org/sqlalchemy/trunk, not the .2 branch): import mx.DateTime as mxDateTime from sqlalchemy import * e = create_engine("postgres://database=test", echo=True) test = Table("test", e, Column("id", String, primar

[Sqlalchemy-users] select using predefined relationships

2006-05-04 Thread Randall Smith
One feature that caught my attention when I first started using sqlalchemy was this example: l = User.mapper.select_by(street='123 Green Street') This is in the section entitled 'Useful Feature: Creating Joins via select_by' and it touches on something I think is severely needed. If you're g

Re: [Sqlalchemy-users] session context proposal

2006-05-04 Thread Gustavo Niemeyer
> def default_session(obj=None): > default_session = getattr(obj, "__default_session__") That of course should include None as the third argument, otherwise the AttributeError is raised as well. -- Gustavo Niemeyer http://niemeyer.net ---

Re: [Sqlalchemy-users] session context proposal

2006-05-04 Thread Michael Bayer
On May 2, 2006, at 8:42 PM, Daniel Miller wrote: Oh, and use a try/except block rather than hasattr. It's more pythonic... So with all those suggestions this is what we end up with: def default_session(obj=None): try: return obj.__default_session__() except AttributeError:

Re: [Sqlalchemy-users] mapper.select and limit=

2006-05-04 Thread Michael Bayer
I juts commited a tweak in 1387 to make this easier. your test program can do: ret = m.select("city_name = 'Rome'", from_obj=[cities], limit=10) giving you: SELECT users.city_id AS users_city_id, users.user_name AS users_user_name, city_e54b.city_id AS city_e54b_city_id, city_e54

Re: [Sqlalchemy-users] mapper.select and limit=

2006-05-04 Thread Michael Bayer
well in this example youre not really getting what you want in any case. youre trying to depend upon the eager load conditions already joining in the "cities" table but thats not really how that was meant to be done; the eager/lazy load thing is meant to be as transparent as possible from

[Sqlalchemy-users] Re: SQLAlchemy 0.2 docs preview

2006-05-04 Thread j.kartnaller
Michael Bayer wrote: I have been trying to work on these as much as possible in the past two weeks as many of the pages had to be almost totally rewritten. still not done, "advanced datamapping", "types", "pooling" and the docstrings are still pretty out of whack, and theres nothing yet about

Re: [Sqlalchemy-users] SQLAlchemy 0.2 docs preview

2006-05-04 Thread Jamie Wilkinson
This one time, at band camp, Michael Bayer wrote: >But at least so folks can read the tutorial, and get an idea of where >its all going, and of course to raise any red flags before I start >moving the whole thing to the trunk and going more public (a lot more >public ! someone has built a te

Re: [Sqlalchemy-users] SQLAlchemy tutorial

2006-05-04 Thread Kevin Dangoor
On 5/3/06, Robin Munn <[EMAIL PROTECTED]> wrote: I was recommending SQLAlchemy to several of my co-workers, and someone asked me if I could write up a short introduction to SQLAlchemy. Well, my short introduction turned into a full-blown tutorial. I've put it on the Web at http://www.rmunn.com/sq

[Sqlalchemy-users] mapper.select and limit=

2006-05-04 Thread Sandro Dentella
Hi everybody, in the script reported below mapper.select will fail in presence of 'limit' parameter if the condition is given as literal rather than with column object and the mapper is a join: ret = m.select(cities.c.city_name == 'Rome' , limit=10) #ret = m.select("city_name = 'Rome'" , li