On Tue, 2012-12-04 at 08:53:43 -0800, junepeach wrote:
> We can turn on 'PRAGMA foreign_key = on' when running sqlite3 database
> system manually.  However it is not a convenient way. So I wonder when
> I run the migration script using sqlalchemy and alembic tool,
> targeting sqlite3, is there a way to enforce the foreign key
> constraint in the migration script, or configuration script. 

In SQLAlchemy it can be done using events, see
<http://docs.sqlalchemy.org/en/rel_0_7/dialects/sqlite.html#foreign-key-support>.
Can't say anything about Alembic, as I haven't played with it yet
(though I'm planning to).

-- 
Audrius Kažukauskas
http://neutrino.lt/

Attachment: pgpj5yyZ61cGu.pgp
Description: PGP signature

Reply via email to