[Sqlalchemy-tickets] Issue #3135: Multiple dialect support in Call Level Interface (CLI/ODBC) conne
Brought to you by:
zzzeek
|
From: David J. <iss...@bi...> - 2014-07-23 14:43:57
|
New issue 3135: Multiple dialect support in Call Level Interface (CLI/ODBC) connections https://bitbucket.org/zzzeek/sqlalchemy/issue/3135/multiple-dialect-support-in-call-level David Jung: Several enterprise RDBMs support connection via the Call Level Interface (CLI) protocol (ISO/IEC 9075-3:2003) - commonly referred to as ODBC or as various vendor-specific names, though technically ODBC is only Microsoft's implementation of CLI. For example, the IBM PureData product line of data warehouses run Redhat Linux and a modified version of PostgreSQL internally, but provide only CLI (ODBC) as an external service protocol. Such RDBMSs can be connected to via SQLAlchemy using pyodbc, but alas SQLAlchemy seems to assume it is connecting to an MSSQL server and only allows the mssql dialect to be specified. For example: ``` #!python engine = create_engine('postgresql+pyodbc://user:pw@server') ``` results in the exception: NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgresql.pyodbc Whereas using: ``` #!python engine = create_engine('mssql+pyodbc://user:pw@server') ``` will succeed in creating the connection, but attempted use results in the error: ``` #!python ProgrammingError: (ProgrammingError) ('42S02', "[42S02] ERROR: Function 'USER_NAME()' does not exist\n\tUnable to identify a function that satisfies the given argument types\n\tYou may need to add explicit typecasts (29) (SQLExecDirectW)") 'SELECT user_name()' () ``` due to the use of an MSSQL specific function with PostgreSQL (the query issued was a simple SELECT * FROM table - so the SELECT user_name() was presumably generated by SQLAlchemy). Please allow the specification of arbitrary dialects when connecting via the CLI/ODBC protocol (pyodbc) so that the dialect can be specified to match the RDBMS in question. |