Closed tkorvola closed 2 years ago
HI @tkorvola, thanks for raising this issue.
Could you refer me to where you found that this is against DBAPI. I don't seem to find that on https://peps.python.org/pep-0249/#cursor-objects
Could you maybe rename the issue to "Configure experimental_python_types
parameter through the Connection object"? That way we are backwards compatible and also support the SQLAlchemy use case.
You can of course keep the current optional parameter of cursor
. It is just not part of DBAPI, thus frameworks built on DBAPI can't be expected to support it. In contrast, they can be expected to support passing arbitrary parameters to connect
.
Currently
connection.cursor(experimental_python_types=True)
is needed to enable support for, e.g., timestamps. It is against DBAPI forcursor
to take parameters and SQLAlchemy does not seem to provide any means for passing them. I'd suggest moving the flag toconnect
, where database dependent parameters are allowed; in SQLAlchemy you'd pass them asconnect_args
tocreate_engine
.