Commits

Anonymous committed 6e45f9f

Added a new 'max_identifier_length' keyword to the mssql_pyodbc dialect

Comments (0)

Files changed (2)

        dialect.  Will substitute into the ODBC connection string
        if given, defaults to 'SQL Server'.
 
+     - Added a new 'max_identifier_length' keyword parameter
+       for the pyodbc dialect. 
+
      - Improvements to pyodbc + Unix. If you couldn't get that
        combination to work before, please try again.
 

lib/sqlalchemy/databases/mssql.py

     def is_disconnect(self, e):
         return isinstance(e, self.dbapi.DatabaseError) and "Error 10054" in str(e)
 
+
 class MSSQLDialect_pyodbc(MSSQLDialect):
     supports_sane_rowcount = False
     supports_sane_multi_rowcount = False
     ischema_names['datetime'] = MSDateTime_pyodbc
 
     def make_connect_string(self, keys):
+        if 'max_identifier_length' in keys:
+            self.max_identifier_length = int(keys.pop('max_identifier_length'))
         if 'dsn' in keys:
             connectors = ['dsn=%s' % keys['dsn']]
         else:
-            connectors = ["DRIVER={%s}" % keys.get('driver', 'SQL Server'),
+            connectors = ["DRIVER={%s}" % keys.pop('driver', 'SQL Server'),
                           'Server=%s' % keys['host'],
                           'Database=%s' % keys['database'] ]
             if 'port' in keys: