Thanks for the reply Mike. I've been tracking SQLAlchemy for years now and it's probably some of the best code, docs, and support I've ever seen.
Yes, I have verified that pyodbc and the pooling flag work: In [1]: import pyodbc In [2]: pyodbc.pooling = False In [3]: conn = pyodbc.connect pyodbc.connect In [3]: conn = pyodbc.connect('DSN=tdprod') In [4]: conn.execute('select current_timestamp').fetchall() Out[4]: [(datetime.datetime(2014, 10, 24, 9, 22, 34, 270000), )] In [5]: pyodbc.pooling = True In [6]: conn.execute('select current_timestamp').fetchall() Out[6]: [(datetime.datetime(2014, 10, 24, 9, 22, 46, 500000), )] Without pooling (and with core dump): In [1]: import pyodbc In [2]: conn = pyodbc.connect('DSN=tdprod') Fatal Python error: Unable to set SQL_ATTR_CONNECTION_POOLING attribute. Aborted (core dumped) Since a "generic" pyodbc connection is out, can you comment on how I could set the pyodbc.pooling flag as part of a dialect? To get me off the ground please see below for my bootstrap base.py and pyodbc.py for a Teradata dialect that could use pyodbc. I have been unable to set pyodbc.pooling appropriately. Feel free to comment additionally on the best way to create a minimal functional dialect that would pass a basic test harness. <base.py> import operator import re from sqlalchemy.sql import compiler, expression, text, bindparam from sqlalchemy.engine import default, base, reflection from sqlalchemy import types as sqltypes from sqlalchemy.sql import operators as sql_operators from sqlalchemy import schema as sa_schema from sqlalchemy import util, sql, exc from sqlalchemy.types import CHAR, VARCHAR, TIME, NCHAR, NVARCHAR,\ TEXT, DATE, DATETIME, FLOAT, NUMERIC,\ BIGINT, INT, INTEGER, SMALLINT, BINARY,\ VARBINARY, DECIMAL, TIMESTAMP, Unicode,\ UnicodeText, REAL RESERVED_WORDS = set([]) class TeradataTypeCompiler(compiler.GenericTypeCompiler): pass class TeradataInspector(reflection.Inspector): pass class TeradataExecutionContext(default.DefaultExecutionContext): pass class TeradataSQLCompiler(compiler.SQLCompiler): pass class TeradataDDLCompiler(compiler.DDLCompiler): pass class TeradataIdentifierPreparer(compiler.IdentifierPreparer): reserved_words = RESERVED_WORDS class TeradataDialect(default.DefaultDialect): pass </base.py> <pyodbc.py> import pyodbc from .base import TeradataDialect, TeradataExecutionContext from sqlalchemy.connectors.pyodbc import PyODBCConnector pyodbc.pooling = False class TeradataExecutionContext_pyodbc(TeradataExecutionContext): pass class TeradataDialect_pyodbc(PyODBCConnector, TeradataDialect): execution_ctx_cls = TeradataExecutionContext_pyodbc pyodbc_driver_name = 'Teradata' def initialize(self, connection): # Teradata requires pooling off for pyodbc super(TeradataDialect_pyodbc, self).initialize(connection) self.dbapi.pooling = False dialect = TeradataDialect_pyodbc </pyodbc.py> If there is any way to make this simpler please let me know, but in particular for this very simple dialect I need to be able to set the pyodbc.pooling attribute to False. On Thursday, October 23, 2014 9:38:30 PM UTC-7, Michael Bayer wrote: > > > On Oct 23, 2014, at 2:50 PM, Lycovian <mfwi...@gmail.com <javascript:>> > wrote: > > Is there a way to use a pyodbc connection without a dialect? > > > there is not. the dialect is responsible for formulating SQL of the > format that the database understands as well as dealing with idiosyncrasies > of the DBAPI driver (of which pyodbc has many, many, many, which are also > specific to certain databases). > > > > Barring that working which seems unlikely since I can't find any working > examples, I have started stubbing out a very simple Teradata dialect but I > can't figure out how to manually set pyodbc.pooling = False. This is > required as the TD ODBC driver will core dump on connect if this isn't set. > I've tried the following in the my pyodbc.py my dialect but on testing it > core dumps indicating the value isn't being set. > > Here is the pyodbc.py for my TD dialect. I'm trying to control pooling in > two different ways in this example but neither works: > > > > > > have you tried talking to your database using just pyodbc directly? does > this flag even work ? > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.