[sqlalchemy] Re: save_or_update() with a unique but not primary key

2007-03-13 Thread Sean Davis
On Tuesday 13 March 2007 07:35, Sean Davis wrote: We are creating a database that will have a set of autoincrement primary keys on the tables. However, many of the tables also have one or more unique keys associated with them. Can we use save_or_update() (and, by extension,

[sqlalchemy] Re: DynamicMetaData question

2007-03-13 Thread Sébastien LELONG
[...] I couldn't use BoundMetaData because I don't know the connection parameters until much after import time, so I am using the only other option I know of, which is DynamicMetaData [...]. I have exactly the same problem. One option is to use global_connect and default_metadata (doc:

[sqlalchemy] Re: DynamicMetaData question

2007-03-13 Thread Gaetan de Menten
I only discovered (or at least understood) this thread localness of DynamicMetaData, and honestly, I don't understand in what case it can be useful. It seems like the thread localness is limited to the engine connected to the metadata. So what I'd like to understand is when anyone wouldn't want

[sqlalchemy] Re: Dynamically adding MapperExtension

2007-03-13 Thread percious
I think I came up with a decent solution for this: I do something like: extension = MyMapperExtension() for mapper in mapper_registry.values(): mapper.extension = extension mapper._compile_extensions() If you want all classes currently defined in the metadata to map to your new

[sqlalchemy] Re: save_or_update() with a unique but not primary key

2007-03-13 Thread Michael Bayer
save_or_update() doesnt take any kind of primary key or unique key argument. no specification of anything is needed. Sean Davis wrote: On Tuesday 13 March 2007 07:35, Sean Davis wrote: We are creating a database that will have a set of autoincrement primary keys on the tables. However,

[sqlalchemy] Re: DynamicMetaData question

2007-03-13 Thread Jonathan LaCour
Michael Bayer wrote: My controller actions don't worry about transactions or connections at all, they just execute insert/update/delete/select actions and if an exception is raised, their work is rolled back automatically. well, thats exactly the pattern provided by strategy=threadlocal,

[sqlalchemy] Re: Multi-column primary key

2007-03-13 Thread Mikkel Høgh
Well, that's simple :) On Mar 13, 1:20 am, Michael Bayer [EMAIL PROTECTED] wrote: use a composite primary key - just mark each column with 'primary_key=True'. On Mar 12, 2007, at 2:28 PM, Mikkel Høgh wrote: Hi there, I'm trying to make a small (open source) inventory tracking system

[sqlalchemy] Re: DynamicMetaData question

2007-03-13 Thread sdobrev
What do you think? Hey list, are you confused by the current system ? Please let me know. the only change I would favor here would be to merge connect into MetaData, BoundMetaData and DynamicMetaData stay around for backwards compat for probably forever, and perhaps we add another