[sqlalchemy] Re: Adding meta information to autoloaded objects

2009-03-07 Thread Michael Bayer
On Mar 7, 2009, at 7:30 PM, MikeCo wrote: > > Sometimes we autoload tables that do not have foreign keys specified > in the DDL, but need the relations in SQLA. > > Here are some techniques that seem to work along with my observations. > I'm interested finding best approach. > > We have a parent

[sqlalchemy] Adding meta information to autoloaded objects

2009-03-07 Thread MikeCo
Sometimes we autoload tables that do not have foreign keys specified in the DDL, but need the relations in SQLA. Here are some techniques that seem to work along with my observations. I'm interested finding best approach. We have a parent-child one-to-many relation. The relation will be defined

[sqlalchemy] Re: Using sqlalchemy in twisted.

2009-03-07 Thread Jeff FW
That's pretty similar to what I do, actually, if a bit simpler (but that's good!) One suggestion would be to throw an except (maybe for the base SQLAlchemy exception class) in your try block, otherwise you run the risk of things dying in an ugly way. I'm not familiar with pyamf, so I don't know

[sqlalchemy] Re: Surfacing table and column-level comments to Python classes as docstrings

2009-03-07 Thread phrrn...@googlemail.com
This is beautiful and exactly what I want. Thanks very much. pjjH On Mar 7, 12:08 pm, Michael Bayer wrote: > On Mar 6, 2009, at 10:37 PM, phrrn...@googlemail.com wrote: > > > > > > > I have some metadata on table and some of the columns and would like > > to surface these as docstrings on the

[sqlalchemy] Re: MapperExtension before_update problem

2009-03-07 Thread Michael Bayer
use the connection object passed to the before_update() method to execute all SQL. do not use "implicit execution" as you are doing (i.e. the execute() method on ClauseElements). the usage of multiple connections is likely creating a deadlock, and in any case violates the integrity of

[sqlalchemy] MapperExtension before_update problem

2009-03-07 Thread jo
Hi all, I have a strange behavior using MapperExtension before_update. I created two tables; anag and azi, azi have a foreign key to anag. When I try to change some column value on anag table the HistoryAnag.before_update is correctly triggered and it returns EXT_PASS, but when I try to change s

[sqlalchemy] Re: Error due to MySQL-Python at 1.2.3?

2009-03-07 Thread Ben
Thanks a lot~ I should have added it earlier. Ben -- Ben Cheng | Software Architect | Oursky Ltd. | M +852 9381-6083 | www.bencheng.net On Sun, Mar 8, 2009 at 1:25 AM, Michael Bayer wrote: > > nevermind i added it myself > > https://sourceforge.net/tracker/index.php?func=detail&aid=2671682&gr

[sqlalchemy] Re: Error due to MySQL-Python at 1.2.3?

2009-03-07 Thread Michael Bayer
nevermind i added it myself https://sourceforge.net/tracker/index.php?func=detail&aid=2671682&group_id=22307&atid=374932 On Mar 7, 2009, at 12:17 PM, Michael Bayer wrote: > > can you please report this as a bug in MySQL 1.2.3b1. The exception > raised looks like this in pdb: > > ProgrammingE

[sqlalchemy] Re: Error due to MySQL-Python at 1.2.3?

2009-03-07 Thread Michael Bayer
can you please report this as a bug in MySQL 1.2.3b1. The exception raised looks like this in pdb: ProgrammingError(ProgrammingError(1146, "Table 'test.t1' doesn't exist"),) i.e., it raises a ProgrammingError, where first argument is in fact another instance of ProgrammingError.We c

[sqlalchemy] Re: Surfacing table and column-level comments to Python classes as docstrings

2009-03-07 Thread Michael Bayer
On Mar 6, 2009, at 10:37 PM, phrrn...@googlemail.com wrote: > > I have some metadata on table and some of the columns and would like > to surface these as docstrings on the mapped class and columns. > > If table foo has columns i, j, k with comments 'apple', 'banana', > 'pear', respectively, an