Pragmas, foreign keys in sqlite3?
llanitedave at veawb.coop
Thu Mar 15 17:59:54 CET 2012
Several questions here, but they're related.
I'm trying to incorporate an sqlite3 database that was created using
Sqliteman1.2.2. I don't know what version of sqlite3 that one uses,
but it seems to have ignored any attempts to create foreign keys for
I'm using Python 2.7.2, and I know that the sqlite3 version that it
contains is 3.7.7. Therefore, it should be able to handle foreign
keys. Where I'm clueless is about how to get that information out of
it, and how to implement or add foreign keys to existing tables.
Is there some way to use the sqlite PRAGMA command from within python?
I tried connecting to the database and got
>>> cr.execute('''PRAGMA foreign_keys;''')
<sqlite3.Cursor object at 0xb7335720>
using "inspect.getmembers()" I got a huge list of everything; it lets
me see that there's no foreign key created, but I can't get that
particular tuple separated out, and I have no idea how to add them.
Do I need to recreate the entire database structure from scratch?
More information about the Python-list