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/mssql.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/mssql.py')
-rw-r--r-- | lib/sqlalchemy/databases/mssql.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 94fbd622f..03197b00f 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -345,11 +345,12 @@ class MSSQLDialect(ansisql.ANSIDialect): order_by=[columns.c.ordinal_position]) c = connection.execute(s) + found_table = False while True: row = c.fetchone() if row is None: break - + found_table = True (name, type, nullable, charlen, numericprec, numericscale, default) = ( row[columns.c.column_name], row[columns.c.data_type], @@ -371,8 +372,10 @@ class MSSQLDialect(ansisql.ANSIDialect): colargs.append(PassiveDefault(sql.text(default))) table.append_item(schema.Column(name, coltype, nullable=nullable, *colargs)) - - + + if not found_table: + raise exceptions.NoSuchTableError(table.name) + # We also run an sp_columns to check for identity columns: # FIXME: note that this only fetches the existence of an identity column, not it's properties like (seed, increment) # also, add a check to make sure we specify the schema name of the table |