[sqlalchemy] Re: Selecting what properties of an object will be loaded

2008-10-17 Thread Alex K
Cool, thanx On 16 окт, 19:15, Ants Aasma [EMAIL PROTECTED] wrote: With session.query(User).options(undefer(User.column_a), defer(User.column_b), noload(User.column_c)) column_a will be loaded with the query, column_b will be loaded on access and column_c will be None regardless of the value

[sqlalchemy] Re: how to print a constructed query with it's parameters?

2008-10-17 Thread Pavel Skvazh
Thanks for the solution! But i get the warning for this query: SELECT address.name AS address_lang, user.name AS user_name FROM addresses LEFT OUTER JOIN user ON user.id = address.user_id Throws sqlalchemy-0.5.0rc2dev_r5150-py2.5.egg\sqlalchemy\sql\expression.py: 1616: SAWarning: Column 'name'

[sqlalchemy] Changing loglevels

2008-10-17 Thread Ids
Hi, I'm using SQLA 0.5.0rc2 and am running into a problem. I've got a piece of code like this: import sys import logging import sqlalchemy as sa from sqlalchemy.orm import sessionmaker logging.basicConfig(stream=sys.stderr) logging.getLogger('sqlalchemy.pool').setLevel(logging.ERROR) engine =

[sqlalchemy] Re: Changing loglevels

2008-10-17 Thread Michael Bayer
On Oct 17, 2008, at 9:22 AM, Ids wrote: Hi, I'm using SQLA 0.5.0rc2 and am running into a problem. I've got a piece of code like this: import sys import logging import sqlalchemy as sa from sqlalchemy.orm import sessionmaker logging.basicConfig(stream=sys.stderr)

[sqlalchemy] relation, primaryjoin, uselist=False How to LIMIT to 1?

2008-10-17 Thread g00fy
hi, on Mapper() i have relation() i use primaryjoin, and uselist=False, but i also want to have LIMIT=1 on my join it would be much faster!! SA should add the limit itself when uselist=False --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: relation, primaryjoin, uselist=False How to LIMIT to 1?

2008-10-17 Thread Michael Bayer
On Oct 17, 2008, at 3:32 PM, g00fy wrote: hi, on Mapper() i have relation() i use primaryjoin, and uselist=False, but i also want to have LIMIT=1 on my join it would be much faster!! SA should add the limit itself when uselist=False uselist=False is intended for a one-to-one relation

[sqlalchemy] Re: relation, primaryjoin, uselist=False How to LIMIT to 1?

2008-10-17 Thread g00fy
I can't make this work with my relation: mapper(Warehouse, warehouse_table,properties = { 'translation': relation( WarehouseTranslation, lazy = False, uselist = False,

[sqlalchemy] Re: relation, primaryjoin, uselist=False How to LIMIT to 1?

2008-10-17 Thread Michael Bayer
On Oct 17, 2008, at 4:22 PM, g00fy wrote: I can't make this work with my relation: mapper(Warehouse, warehouse_table,properties = { 'translation': relation( WarehouseTranslation, lazy = False,

[sqlalchemy] Re: Problem with func and string concatenation

2008-10-17 Thread Michael Bayer
On Oct 16, 11:41 am, Adam [EMAIL PROTECTED] wrote: I'm using Postgres 8.3 and sqlalchemy 0.5.0rc2 - when I'm doing a select, it seems I can't concatenate a function with another column - rather that use the || operator, it tries to use the || operator. Code to reproduce example: import

[sqlalchemy] Re: How are connections managed?

2008-10-17 Thread Michael Bayer
On Oct 16, 9:39 am, Heston James - Cold Beans [EMAIL PROTECTED] wrote: Afternoon Guys, I have a suspicion that I'm leaving MySQL database connections open when I shouldn't be and I'm trying to understand how they are managed by SQLAlchemy. I currently create an engine instance and bind

[sqlalchemy] executemany upate

2008-10-17 Thread J Stam
Is there a way to do executemany() semantic updates? Suppose I have a list of employee id's and I want to do something like: ids = [1, 2, 3, 4, 5, 6] session.execute( tbl_employees.update(tbl_employees.c.id == ids), tbl_employees.c.status=you're fired )