unixODBC error on MacOS
lthibault opened this issue · 2 comments
lthibault commented
Hello, I'm attempting to connect to an in-memory SQLite database in the following manner.
import asyncio
import aioodbc
DB_CONNSTR = "Driver=SQLite;Database=:memory:"
async def run_db_loop(q):
conn = await aioodbc.connect(dsn=DB_CONNSTR, loop=loop)
loop.run_until_complete(run_db_loop(queue.async_q))
This produces the following error on macOS Sierra v10.12.6:
~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/aioodbc/connection.py in _connect(dsn, autocommit, ansi, timeout, loop, executor, echo, **kwargs)
43 timeout=timeout, echo=echo, loop=loop, executor=executor,
44 **kwargs)
---> 45 await conn._connect()
46 return conn
47
~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/aioodbc/connection.py in _connect(self)
81 timeout=self._timeout,
82 **self._kwargs)
---> 83 self._conn = await f
84
85 @property
~/.pyenv/versions/3.6.2/lib/python3.6/concurrent/futures/thread.py in run(self)
53
54 try:
---> 55 result = self.fn(*self.args, **self.kwargs)
56 except BaseException as e:
57 self.future.set_exception(e)
Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQLite' : file not found (0) (SQLDriverConnect)")
Prior to running the script I performed brew install unixodbc
.
Any idea what might be going on here?
jettify commented
Hi I never tested on macs but I think idea is the same, you have to install .so
odbc compatible driver for sqlite and update your system odbcinst.ini
, we do this in tests for mysql (looks like sqlite driver registers itself there during install)
Lines 8 to 12 in 126cd13
For more information about configuration see:
http://www.unixodbc.org/odbcinst.html
jettify commented
closing for now feel free to reopen if you have more questions.