[Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
Hey, Just started using 0.2.1, it's pretty neat, though converting from objectstore to session was a bit of a mindbender; thanks to rmunn for the tutorial though, it filled in the major points so I was able to fix it good. Still not sure if I like the explicit session better than the implicit

Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Robin Munn
On 5/29/06, Jamie Wilkinson [EMAIL PROTECTED] wrote: So, I want to map an instance of Person onto both tables, so that part of the information is stored in 'account', and some in 'person'. Obviously there will be cases where rows in 'account' don't map to rows in 'person', so we want the

[bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
This one time, at band camp, Robin Munn wrote: Have you looked at http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_joins yet? From those docs, it looks like you should be able to simply do mapper(Person, join(account, person)) and have it work as you expect, with a two-column

Re: [Sqlalchemy-users] SQLAlchemy 0.2.1 released

2006-05-29 Thread Rick Morrison
...on a holiday weekend, no less.Go, Mike, go!On 5/28/06, Michael Bayer [EMAIL PROTECTED] wrote:Releasing 0.2.0 last night was so much fun, i just had to do itagain.Some threaded environments revealed a big blunder in the connection pool where I forgot to restore a plain dictionary to itsproper

[Sqlalchemy-users] ActiveMapper + custom function (func.xx)

2006-05-29 Thread lukas miskovic
Hi, iam new to sqlalchemy and i would like to ask if its possible to : - use custom function like ... func.CUSTOM_FUNCTION - select only specific columns - use extension plugins with ActiveMapper. Thanks regards /luke --- All the

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Michael Bayer
you can hack this with a MapperExtension after_insert rule that sets the account_id field on the Person object after the account table is inserted. a little ugly but probably would work right now. right now, the mapper youve made considers the primary key of of Person to be (person.id,

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
On May 29, 2006, at 11:33 AM, Brad Clements wrote: Or in other words, why can't I use the same code under both plain and threadlocal? you can. __del__ and close() are always available in the exact same way regardless of threadlocal status, both return the connection to the pool (in the

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
hi list - Pursuant to this discussion, I propose we change the close() method, illustrated below: result = sometable.select().execute() result.close() to this: result = sometable.select().execute() result.close_connection() to eliminate confusion this may

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Brad Clements
On 29 May 2006 at 13:16, Michael Bayer wrote: Pursuant to this discussion, I propose we change the close() method, illustrated below: result = sometable.select().execute() result.close() to this: result = sometable.select().execute() result.close_connection() to eliminate

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Brad Clements
On 29 May 2006 at 13:09, Michael Bayer wrote: I want to use resultset.close() in ALL of my code, so that it will work correctly under either strategy. go nuts. should all work fine. all the work ive done in this area was designed specifically towards your request for this

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
only because close does not do the traditional thing that close () does on a cursor object, which is simply close the cursor, but not affecting the connection which the cursor is assocaited with. this particular close() method insetad returns a connection to a connection pool. but it

[Sqlalchemy-users] Rough firebird.py diff for 0.21

2006-05-29 Thread Brad Clements
I've only tested a very basic table.get() and table.select.. haven't tested updates. (attached) The following section of this message contains a file attachment prepared for transmission using the Internet MIME message format. If you are using Pegasus Mail, or any other MIME-compliant system,

Re: [Sqlalchemy-users] Firebird engine doesn't work?

2006-05-29 Thread Michael Bayer
fb hasnt been ported to 0.2 yet. ironically, it was only fixed in 0.1 like a week ago. feel free to give porting it a try since i dont have firebird installed here. On May 29, 2006, at 3:34 PM, Brad Clements wrote: In rev 1550 File e:\prj\src\sqlalchemy\lib\sqlalchemy\databases

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
This one time, at band camp, Michael Bayer wrote: you can hack this with a MapperExtension after_insert rule that sets the account_id field on the Person object after the account table is inserted. a little ugly but probably would work right now. I'll try the hack now and let you know how it

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Michael Bayer
it maps against multiple tables no problem as long as all the other columns in them contain proper data; whats missing is the extra step to automatically synchronize newly generated primary keys from one table to foreign keys in the other. theres a method in place that takes join

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
This one time, at band camp, Michael Bayer wrote: the zblog demo has an example of mapping against multiple tables, it maps Post objects against a join of the posts table against an aggregate count of the comments table with some extra GROUP BY stuff worked in, so that when you get the list

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
This one time, at band camp, Michael Bayer wrote: you can hack this with a MapperExtension after_insert rule that sets the account_id field on the Person object after the account table is inserted. a little ugly but probably would work right now. I'm having trouble working out where to get

Re: [bug?] Re: [Sqlalchemy-users] mapping two tables to one object

2006-05-29 Thread Jamie Wilkinson
This one time, at band camp, Jamie Wilkinson wrote: This one time, at band camp, Michael Bayer wrote: you can hack this with a MapperExtension after_insert rule that sets the account_id field on the Person object after the account table is inserted. a little ugly but probably would work right

[Sqlalchemy-users] Getting mappers back out of SA

2006-05-29 Thread Jamie Wilkinson
Is there a way to query SA for the current set of mappers, and get the mapper for a particular class? Ben Bangert's contentstor module attaches the mapper to the class, but I was wondering if there's a way to get the mapper out of SA directly and remove the need for keeping a reference to the