From: Oleg B. <ph...@ph...> - 2005-12-26 16:51:10
|
On Wed, Dec 14, 2005 at 04:40:52PM -0500, Martin Blais wrote: > On 12/14/05, Oleg Broytmann <ph...@ph...> wrote: > > Think one wants > > to create two tables that reference each other. It was impossible to do in > > SQLObject because SQLObject tried to create a table with all constrints... > > and databases return errors becuase the table to be created reference > > another table that hasn't been created yet. > > So .createTable() machinery was changed to create tabes without > > constrinas and return necceessary ALTER TABLES command which you should > > execute after table creation. Something like this: > > Is anyone keeping track of these important API changes somewhere? > Because if no-one is, the task to port 0.6-based apps to 0.7 will be a > perilous one. Both of the bugs/changes required from this thread do > not generate warnings when upgrading. > > Why not make the default case nice (i.e. create the constraints by > default), and letting the user prevent the constraints creation from > being done when this is needed (e.g. with a keyword argument) ? Well, I am ready to commit changes. SQLObject.createTable() got a new keyword, applyConstraints, True by default. So you do either MyTable1.createTable() MyTable2.createTable() or constrints = MyTable1.createTable(applyConstraints=False) constrints += MyTable2.createTable(applyConstraints=False) for constraint in constraints: conn.query(constraint) Is it ok? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |