- changed status to resolved
Url parsing for mysql+pyodbc broken?
When i try to make an pyodbc connect as described in documentation: engine = create_engine('mysql+pyodbc://'+user+:+'passwd'+'@'+dsn+'?encoding=utf8&charset=utf8') i get: sqlalchemy.exc.DBAPIError: (Error) ('IM012', 'IM012 unixODBCManagerDRIVER keyword syntax error (0) (SQLDriverConnectW)') None None when i add driver: engine = create_engine('mysql+pyodbc://'+user+':'+'passwd'+'@'+dsn+'?encoding=utf8&charset=utf8&drivermyodbc-5.1') i get: sqlalchemy.exc.DBAPIError: (Error) ('IM012', 'IM012 unixODBCManagerDRIVER keyword syntax error (0) (SQLDriverConnectW)') None None Note: the dsn is sufficient whe i use pyodbc directly. I got it working with following call: engine = create_engine('mysql+pyodbc://'+dsn,connect_args={'charset':'utf8','encoding':'utf8','dsn':dsn,'driver':'myodbc-5.1','user':user,'password':passwd})
Comments (5)
-
repo owner -
Account Deleted - changed status to open
- removed status
why dosen't this work for me: create_engine('mysql+pyodbc://'+ user + ':' + passwd +'@'+ dsn + '?encoding=utf8',connect_args={'charset':'utf8'}) but this works: create_engine('mysql+pyodbc://'+user+':'+passwd+'@'+dsn,connect_args={'charset':'utf8','encoding':'utf8'}) in the documentation i read that same ways of parameter supplyment should lead to the same result. i tried also to pass the charset via url but that led to bad keyword: sqlalchemy.exc.DBAPIError: (Error) ('IM012', 'IM012 unixODBCManagerDRIVER keyword syntax error (0) (SQLDriverConnectW)') None None. so it just might not be accepted.
Furthermore i noticed, that the documentation suggests here : http://www.sqlalchemy.org/docs/06/reference/sqlalchemy/connections.html?highlight=encoding
to set the encoding to 'utf-8' which lead to segmentation fault of the python interpreter on my machine
-
Account Deleted Soryy: in the documentation i read that same ways of parameter supplyment should lead to the same result. i tried also to pass the charset via url but that led to bad keyword: should mean: in the documentation i read that BOTH ways of parameter supplyment should lead to the same result. i tried also to pass the charset via url but that led to bad keyword:
-
repo owner - changed status to invalid
you mean to put a slash at the end:
create_engine('mysql+pyodbc://scott:tiger@dsn/?encoding=utf8')
Per pyodbc documentation, passing it as connect_args() should fail. Per http://code.google.com/p/pyodbc/wiki/Module the only arguments you can pass in connect_args are 'autocommit', 'ansi', 'unicode_results'. the rest have to be embedded in the DSN which is what passing them as ?foo=bar does.
-
repo owner - removed milestone
Removing milestone: 0.6.xx (automated comment)
- Log in to comment
what are all the plus signs for ? here is the correct syntax:
mysql+pyodbc://scott:tiger@mysql_test
there was a small bug in the dialect constructor which is fixed in c43073b65951051c23fe7b05a76e7cec3f2762de.