diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-16 01:40:51 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-16 01:40:51 +0000 |
commit | abdf3a22ccb23f2cfc7e5cf8b815c62f925d7b0d (patch) | |
tree | 0a93906068fc793b377a16f0873b247c8b05a749 | |
parent | f72378137a855098c4f0c1c830e3b244634cbd84 (diff) | |
download | sqlalchemy-abdf3a22ccb23f2cfc7e5cf8b815c62f925d7b0d.tar.gz |
reflect MSSQL cols that have descending markers [ticket:1629]
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 1060446b2..8f52c4b12 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1228,6 +1228,7 @@ class MSDialect(default.DefaultDialect): @reflection.cache def get_indexes(self, connection, tablename, schema=None, **kw): current_schema = schema or self.default_schema_name + col_finder = re.compile("(\w+)") full_tname = "%s.%s" % (current_schema, tablename) indexes = [] s = sql.text("exec sp_helpindex '%s'" % full_tname) @@ -1239,7 +1240,7 @@ class MSDialect(default.DefaultDialect): if 'primary key' not in row['index_description']: indexes.append({ 'name' : row['index_name'], - 'column_names' : [c.strip() for c in row['index_keys'].split(',')], + 'column_names' : col_finder.findall(row['index_keys']), 'unique': 'unique' in row['index_description'] }) return indexes |