diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-06 00:11:54 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-06 00:11:54 +0000 |
| commit | bdb41655d14caed41e93225f79e5554925a15e20 (patch) | |
| tree | 7e7ecf0d0dfb59b14bc34f77c5ae29e37f9f1755 /lib/sqlalchemy/databases/sqlite.py | |
| parent | e69fa9c45d77b2c27311d54155c78ee44ce551f9 (diff) | |
| download | sqlalchemy-bdb41655d14caed41e93225f79e5554925a15e20.tar.gz | |
added "NonExistentTable" exception throw to reflection, courtesy lbruno@republico.estv.ipv.pt, for [ticket:138]
Diffstat (limited to 'lib/sqlalchemy/databases/sqlite.py')
| -rw-r--r-- | lib/sqlalchemy/databases/sqlite.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index f074d02fa..b2aeb75fd 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -158,11 +158,13 @@ class SQLiteDialect(ansisql.ANSIDialect): def reflecttable(self, connection, table): c = connection.execute("PRAGMA table_info(" + table.name + ")", {}) + found_table = False while True: row = c.fetchone() if row is None: break #print "row! " + repr(row) + found_table = True (name, type, nullable, primary_key) = (row[1], row[2].upper(), not row[3], row[5]) match = re.match(r'(\w+)(\(.*?\))?', type) @@ -176,6 +178,10 @@ class SQLiteDialect(ansisql.ANSIDialect): #print "args! " +repr(args) coltype = coltype(*[int(a) for a in args]) table.append_item(schema.Column(name, coltype, primary_key = primary_key, nullable = nullable)) + + if not found_table: + raise exceptions.NoSuchTableError(table.name) + c = connection.execute("PRAGMA foreign_key_list(" + table.name + ")", {}) while True: row = c.fetchone() |
