Re: [Sqlalchemy-users] select_by ORDER BY/LIMIT etc.

2006-05-11 Thread HD Mail
Michael Bayer wrote: On May 11, 2006, at 12:54 PM, HD Mail wrote: This seems to facilitate a much more flexible style of building select statements, rather then passing these things as parameters. It would be nice to make the select() also using this style. so building selects can be s = se

Re: [Sqlalchemy-users] threads / unit of work and cherrypy

2006-05-11 Thread Michael Bayer
jonathan - it all changes for the better in 0.2. forget about objectstore.begin (). check it out at: http://www.sqlalchemy.org/docs_02/ On May 11, 2006, at 8:43 PM, Jonathan Vanasco wrote: i'm using sqlalchemy through turbogears turbogears doesn't have all-that-hot support for sqlalc

Re: [Sqlalchemy-users] session context proposal

2006-05-11 Thread Daniel Miller
Michael Bayer wrote: we agree, that there should be some way to turn on this feature: u = User()# 'u' is now automatically in the session session.flush()# 'u' is now saved. I think by default it should require a session.save(u) before the flush (that's exactly what Hibernate

[Sqlalchemy-users] threads / unit of work and cherrypy

2006-05-11 Thread Jonathan Vanasco
i'm using sqlalchemy through turbogears turbogears doesn't have all-that-hot support for sqlalchemy yet, and I can't stand its user visit/identity system, so i'm implementing my own (sorry Kevin) i've come up with the following way to handle what I want to do via the cherrypy request pha

Re: [Sqlalchemy-users] CASE in column list

2006-05-11 Thread Rick Morrison
Hey Mike: Attached please find a patch against trunk r#1441 that implements the SQL CASE construct. I know you've argued in the past for an implementation in some kind of .ext-land, but let me at least present a few arguments for inclusion in the core library. I'll do this in the form of response

Re: [Sqlalchemy-users] CASE in column list

2006-05-11 Thread Michael Bayer
rick -10 lines of code, yah you got it, this is great.   it seemed very complex at the time but this is totally simple.  ill get it checked in soon.- mikeOn May 11, 2006, at 5:17 PM, Rick Morrison wrote:Hey Mike: Attached please find a patch against trunk r#1441 that implements the SQL CASE constr

Re: [Sqlalchemy-users] default timestamp + postgres

2006-05-11 Thread Gambit
Hey Jonathan, Try this: Column('data', String(250), default=func.current_timestamp() + '12 hours') Also, see attached sample for postgresql. -G On Thursday, May 11, 2006, 11:09:41 PM, you wrote: > I'm trying to get SQLalchemy to set this as the insert value: > Column( "timestamp_expire

[Sqlalchemy-users] default timestamp + postgres

2006-05-11 Thread Jonathan Vanasco
I'm trying to get SQLalchemy to set this as the insert value: Column( "timestamp_expires", DateTime, nullable=False , default="NOW() + INTERVAL '12 hours'") , the db looks like this: Column|Type | Modifiers -+--

Re: [Sqlalchemy-users] select_by ORDER BY/LIMIT etc.

2006-05-11 Thread Michael Bayer
On May 11, 2006, at 12:54 PM, HD Mail wrote: This seems to facilitate a much more flexible style of building select statements, rather then passing these things as parameters. It would be nice to make the select() also using this style. so building selects can be s = select([users]) if orde

Re: [Sqlalchemy-users] session context proposal

2006-05-11 Thread Michael Bayer
On May 11, 2006, at 12:03 AM, Daniel Miller wrote: The thread-local mod is implied in all the documentation examples for 0.2; therefore it will be used by most if not all SA users at least at first. When a project starts to move from simple experimentation mode into a full-blown complex p

Re: [Sqlalchemy-users] select_by ORDER BY/LIMIT etc.

2006-05-11 Thread HD Mail
Michael Bayer wrote: because all the keyword arguments to select_by are taken as the names of properties. if select_by had order_by, limit, etc. it would have to look like; x = m.select_by({'name':'jack', 'address':'[EMAIL PROTECTED]'}, order_by=addresses.c.id, limit=10) which we can

Re: [Sqlalchemy-users] session context proposal

2006-05-11 Thread Michael Bayer
On May 11, 2006, at 12:03 AM, Daniel Miller wrote: As I've already said, I object to adding a __call__() method in addition to the "current" property because it adds confusion about the "one obvious way" to get the current session. The "reference implementation" of your "session context" s

Re: [Sqlalchemy-users] Re: Re: How to extend a mapped class?

2006-05-11 Thread Michael Bayer
you can overrride create_instance() in a MapperExtension object. FYI, in 0.2 the __init__ method is not even called when objects are loaded from the DB (but you can still use create_instance() to apply specific behavior). On May 10, 2006, at 2:50 PM, Marty McFly wrote: I just discovered t

[Sqlalchemy-users] Re: problem

2006-05-11 Thread Michael Bayer
you might want to look into trying out 0.2 which has polymorphic support built in; see the examples in examples/polymorphic as well as the "advanced data mapping" section of the docs. its all new code of course so there still could be issues, but im pretty sure itll be totally different is

[Sqlalchemy-users] Re: problem

2006-05-11 Thread Vladimir Iliev
Hi, a month ago I've asked for help with my heterogenous mapping. You've fixed the provided example and it now it commits. Today I've tried it and found that SA can't fetch the committed data from the db. Ideas? from sqlalchemy import * global_connect('sqlite://') element_table = Table('elem

[Sqlalchemy-users] Re: setting echo for global_connect engine

2006-05-11 Thread Alex Greif
I found it myself: schema.default_engine.get_engine().echo = True Alex. On 5/11/06, Alex Greif <[EMAIL PROTECTED]> wrote: Hi I do a global_connect and access the engine afterwards via schema.default_engine. But schema.default_engine.echo = True has no effect Hi can I set the echo flag on this

[Sqlalchemy-users] setting echo for global_connect engine

2006-05-11 Thread Alex Greif
Hi I do a global_connect and access the engine afterwards via schema.default_engine. But schema.default_engine.echo = True has no effect Hi can I set the echo flag on this engine? I am using 0.1.7 Alex. --- Using Tomcat but need to do more?

Re: [Sqlalchemy-users] os.fork() & postgres problems

2006-05-11 Thread alanp
On 10 May 2006, at 6:03 PM, alanp wrote: On 10 May 2006, at 5:56 PM, Jonathan Ellis wrote: On 5/10/06, alanp <[EMAIL PROTECTED]> wrote: The problem is that the commit in the parent process fails with a psycopg error (ProgrammingError: "SET TRANSACTION ISOLATION LEVEL...") when trying to

Re: [Sqlalchemy-users] primary_key parameter on mapper

2006-05-11 Thread Gambit
Hey Sandro, IIRC, the primary_key parameter tells the mapping engine which specific columns compose the primary key for that map. This is used in the identity map to identify already-fetched objects, create relations, and so forth while ensuring there aren't any duplicates involved (i.e. two sepa

[Sqlalchemy-users] primary_key parameter on mapper

2006-05-11 Thread Sandro Dentella
Hi all, I don't really understand which is the role of the 'primary_key' parameter to mapper, particularly when the mapper is built from a join, not a table. Thanks sandro *:-) -- Sandro Dentella *:-) e-mail: [EMAIL PROTECTED] http://www.tksql.orgTkSQL Home p