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-27 14:46:45
|
On Tue, Jan 27, 2009 at 02:12:15PM +0100, Davide Alberani wrote: > What we need is a way to execute a SQL statement like (for MySQL): > ALTER TABLE my_info ADD FOREIGN KEY (kind_id) REFERENCES info_type; The question was 'how to add', not 'how to change'. SQLObject cannot change column types, but you can just execute the query: connection.query('ALTER TABLE my_info ADD FOREIGN KEY (kind_id) REFERENCES info_type') Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |