From: Rick Morrison Date: Wed, 2 Apr 2008 23:03:00 +0000 (+0000) Subject: Added a new 'max_identifier_length' keyword to the mssql_pyodbc dialect X-Git-Tag: rel_0_4_5~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b5051845ba22b9c6ee575e3126fa602114cb91b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Added a new 'max_identifier_length' keyword to the mssql_pyodbc dialect --- diff --git a/CHANGES b/CHANGES index 522eaf1a84..70ca76c307 100644 --- a/CHANGES +++ b/CHANGES @@ -261,6 +261,9 @@ CHANGES 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. diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 849d585071..e0bf2e6bb6 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -741,6 +741,7 @@ class MSSQLDialect_pymssql(MSSQLDialect): 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 @@ -775,10 +776,12 @@ class MSSQLDialect_pyodbc(MSSQLDialect): 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: