[sqlalchemy] MapperExtension examples relating to versioning

2010-06-29 Thread Chris Withers
Hi All, I'm looking for examples of MapperExtensions. Specifically, I'm looking to implement one that creates new rows when certain attributes of an object changes. I'm not sure if this is the right approach, so here's some pseudocode of how I'd like to use the end result: class

Re: [sqlalchemy] mysql vs sqlite for testing

2010-06-29 Thread Chris Withers
Just bumped into these questions which I still don't understand :-S Chris Withers wrote: I use setup/teardowns like this for this purpose (assume scoped_session, which yes you should probably use all the time so that the session is accessed by a single reference): Where do you actually

Re: [sqlalchemy] cross-database joins with MySQL

2010-06-29 Thread Chris Withers
Michael Bayer wrote: We have engines set up like: engine1 = create_engine('mysql://username:passw...@server/db1') engine2 = create_engine('mysql://username:passw...@server/db2') ..and then have them bound to separate sessions, with separate model classes mapped to them. Now, mysql supports

RE: [sqlalchemy] cross-database joins with MySQL

2010-06-29 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Chris Withers Sent: 29 June 2010 10:28 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] cross-database joins with MySQL Michael Bayer wrote: We have engines set up

[sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Chris Withers
Hi All, Is it legit/okay/bad to do things in a MapperExtension's before_insert and/or before_update methods? Specifically, the following: - change the primary key of the instance by deleting it so that the dataabse assigns a new primary key? - do a query to update an existing row? (where

[sqlalchemy] Custom Compiler for MSUniqueIdentifier raises error

2010-06-29 Thread Ed Singleton
The following code (if you replace the uri with a working one) raises an error when run against an MSSQL db, but not against Sqlite. I'm trying to get the same schema (which uses MSUniqueIdentifer) to run against MSSQL and Sqlite. Any help on fixing this is gratefully received, as I'm at a

[sqlalchemy] SQL Alchemy for bigger enterprise application

2010-06-29 Thread Dan @ Austria
Hi, i m a developer with some experience in python and django - a framework i realy like. However, i just read the sqlalchemy docu and i think the orm seems to be really professional. Is sqlalchemy the most prominent orm for python? Is it suitable to write larger enterprise applications? Are

Re: [sqlalchemy] SQL Alchemy for bigger enterprise application

2010-06-29 Thread Chris Withers
Dan @ Austria wrote: Is sqlalchemy the most prominent orm for python? yes. Is it suitable to write larger enterprise applications? yes. Are there any drawbacks to sqlalchemy? sure, as with any piece of software... Are there any other big orm projects for python, which one should

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Michael Bayer
On Jun 29, 2010, at 7:46 AM, Chris Withers wrote: Hi All, Is it legit/okay/bad to do things in a MapperExtension's before_insert and/or before_update methods? Specifically, the following: - change the primary key of the instance by deleting it so that the dataabse assigns a new

Re: [sqlalchemy] Custom Compiler for MSUniqueIdentifier raises error

2010-06-29 Thread Michael Bayer
On Jun 29, 2010, at 9:12 AM, Ed Singleton wrote: The following code (if you replace the uri with a working one) raises an error when run against an MSSQL db, but not against Sqlite. I'm trying to get the same schema (which uses MSUniqueIdentifer) to run against MSSQL and Sqlite. Any

Re: [sqlalchemy] mysql vs sqlite for testing

2010-06-29 Thread Michael Bayer
theres a nesting behavior to transactions, which is illustrated here: http://www.sqlalchemy.org/docs/dbengine.html#using-transactions-with-connection the setup/teardown thing I illustrated uses this functionality with a Session, so that the Session isn't actually committing the real

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Chris Withers
Michael Bayer wrote: Specifically, the following: - change the primary key of the instance by deleting it so that the dataabse assigns a new primary key? that wont work. you need to take the object and call make_transient() on it, re-add it to the session. Where is make_transient

Re: [sqlalchemy] SQL Alchemy for bigger enterprise application

2010-06-29 Thread Timuçin Kızılay
Dan @ Austria yazmış: Hi, i m a developer with some experience in python and django - a framework i realy like. However, i just read the sqlalchemy docu and i think the orm seems to be really professional. Is sqlalchemy the most prominent orm for python? Is it suitable to write larger

[sqlalchemy] looking for something like sql views.

2010-06-29 Thread Timuçin Kızılay
I'm using sqlalchemy with turbogears framework. I have some tables and some complex queries with lots of joins and filters. is tehere a simple way to make those queries like views and use those views in other more complex queries like they are tables? -- You received this message because you

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Michael Bayer
On Jun 29, 2010, at 11:07 AM, Chris Withers wrote: Michael Bayer wrote: Specifically, the following: - change the primary key of the instance by deleting it so that the dataabse assigns a new primary key? that wont work. you need to take the object and call make_transient() on it,

[sqlalchemy] How do I dispose of all engine resources?

2010-06-29 Thread Wyatt Lee Baldwin
Short version: How do I completely dispose of all resources belonging to an engine that uses a standard queue pool? I have a Web service that creates a bunch of engines on demand (that all use the default QueuePool). It needs to close inactive connections after X seconds. I monitor access to

[sqlalchemy] Re: How do I dispose of all engine resources?

2010-06-29 Thread Wyatt Lee Baldwin
On Jun 29, 12:21 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 29, 2010, at 1:47 PM, Wyatt Lee Baldwin wrote: Short version: How do I completely dispose of all resources belonging to an engine that uses a standard queue pool? I'll reference the docs below just so they're here, I

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Chris Withers
Michael Bayer wrote: for thing in session.query(MyThing).all(): ... print x.id, x.name, x.value, x.valid_from, x.valid_to 1, 'foo', 100, 2010-06-29 09:00, 2010-06-29 09:05 2, 'foo', 200, 2010-06-29 09:05, None `x` used to correspond to the row with id of 1, but now corresponds to the row

Re: [sqlalchemy] Re: How do I dispose of all engine resources?

2010-06-29 Thread Michael Bayer
On Jun 29, 2010, at 5:41 PM, Wyatt Lee Baldwin wrote: It's a fairly standard multi-threaded Pylons Web app that calls Session.remove() at the end of each request. All DB operations go through the ORM. Disregarding all the verbiage below, it sounds like Session.remove already does what I

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Michael Bayer
On Jun 29, 2010, at 6:27 PM, Chris Withers wrote: Michael Bayer wrote: for thing in session.query(MyThing).all(): ... print x.id, x.name, x.value, x.valid_from, x.valid_to 1, 'foo', 100, 2010-06-29 09:00, 2010-06-29 09:05 2, 'foo', 200, 2010-06-29 09:05, None `x` used to correspond to

Re: [sqlalchemy] doing stuff in MapperExtension's before_insert and before_update

2010-06-29 Thread Chris Withers
Michael Bayer wrote: - I take it there are no problems with specifying multiple extensions to sessionmaker? (we need zope.sqlalchemy's extension too) What effect does order of extensions have? calls them in order heh, so what order to put 'em in? I'm guessing zope.sqlalchemy's one should