connecting with ssl using mysql+oursql fails
Issue #2047
resolved
sqlalchemy will fail to connect when using ssl in the connect string for a mysql database server using ssl for auth with the oursql dialect.
Fails when a query is executed against the engine:
sqlalchemy.create_engine( "mysql+oursql://localhost:3306/databaseName?ssl_ca=/ca.pem&ssl_cert=/cert.pem&ssl_key=/key.pem" )
But this works fine:
sqlalchemy.create_engine( "mysql://localhost:3306/databaseName?ssl_ca=/ca.pem&ssl_cert=/cert.pem&ssl_key=/key.pem" )
Both MySQLdb and oursql connections take the same set of params with the ssl auth variables living in a dict with 'ssl_ca' 'ssl_cert' and 'ssl_key' as the keys of the dict.
Required to test: mysql server with ssl auth sqlalchemy and oursql
Traceback (starting at sqlalchemy entry after calling .one() on a query object):
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1522, in one
ret = list(self)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1565, in __iter__
return self._execute_and_instances(context)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1570, in _execute_and_instances
mapper=self._mapper_zero_or_none())
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/session.py", line 734, in execute
return self._connection_for_bind(engine, close_with_result=True).execute(
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/session.py", line 699, in _connection_for_bind
return self.transaction._connection_for_bind(engine)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/session.py", line 315, in _connection_for_bind
conn = bind.contextual_connect()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1742, in contextual_connect
self.pool.connect(),
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 158, in connect
return _ConnectionFairy(self).checkout()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 329, in __init__
rec = self._connection_record = pool.get()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 177, in get
return self.do_get()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 692, in do_get
con = self.create_connection()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 138, in create_connection
return _ConnectionRecord(self)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 213, in __init__
self.connection = self.__connect()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 279, in __connect
connection = self.__pool._creator()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/strategies.py", line 76, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/default.py", line 238, in connect
return self.dbapi.connect(*cargs, **cparams)
File "connection.pyx", line 76, in oursql.Connection.__cinit__ (oursqlx/oursql.c:4175)
sqlalchemy.exc.DBAPIError: (TypeError) __cinit__() got an unexpected keyword argument 'ssl_key' None None
Comments (2)
-
repo owner -
repo owner - removed milestone
Removing milestone: 0.6.7 (automated comment)
- Log in to comment
what's strange is the OurSQL dialect was written by the guy that wrote OurSQL, not sure why he didn't port that part of MySQLdb.
ad8700a556d3ec9368dd80238dfddf456eeccd5f 4be34a26999bd54a9cbd2fc28512c18fb35ece64