Hi,

I'm just testing version 0.6 beta 3 with mssql and I've discovered
that reflecting tables with indexes that contains fields with blank
spaces raises a KeyError.

To correct this I've changed sqlalchemy.dialects.mssql.base:

--- sqlalchemy/dialects/mssql/base.py.orig<---->2010-04-14
17:45:54.886344082 +0200
+++ sqlalchemy/dialects/mssql/base.py<->2010-04-14 17:45:22.822346126
+0200
@@ -1090,7 +1090,6
@@
 
@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)
@@ -1102,7 +1101,7
@@
             if 'primary key' not in
row['index_description']:
 
indexes.append({
                     'name' :
row['index_name'],
-                    'column_names' :
col_finder.findall(row['index_keys']),
+                    'column_names' : row['index_keys'].split(',
'),
                     'unique': 'unique' in
row['index_description']
                 })
         return
indexes

Can anybody check this behaviour and then patch the trunk?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to