Re: [SQLObject] How to add a foreign key at runtime
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2009-01-12 17:15:10
|
On Mon, Jan 12, 2009 at 05:19:20PM +0100, Timo Schulz wrote: > I studied the available documentation, but I did not find a hint > if it is possible to add a foreign key, *after* a table (in the > database) was created. > > In short, I need something like that: > "ALTER TABLE foo ADD FOREIGN KEY (dest_id) REFERENCES dest_type" > > Is this possible with SQLObject? Foo.sqlmeta.addColumn( ForeignKey("DestType", name='dest', default=None), changeSchema=True) Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |