0

I want to find a way to specify the path of a driver -- or otherwise resolve problem that Pyodbc cannot find a Vertica driver -- for the following Python 3 command with Pyodbc package

Pyodbc.connect(...)

but I keep getting the error that a Vertica driver 9.0.x cannot be found. I used the installer here and the installer here on macOS.

I currently use an alias Vertica in the command but unknown for the Pyodbc connect so apparently some driver file problem, now need to find a way to resolve this.

How can I specify the location of the driver for pyodbc? Or otherwise resolve why the driver unknown?

Updated comments on TaliTedi answer.

  1. How to confirm that iODBC is up-to-date?

  2. How to build pyodbc with links to iODBC?

  3. The directory ~/Library/ODBC/odbcini does not exist. How to configure the DNSs?

enter image description here

Older pyodbc threads

  1. pyODBC: specify location of driver in Windows
hhh
  • 50,788
  • 62
  • 179
  • 282

1 Answers1

1
  1. Confirm that iODBC is fully up-to-date. (Apple ships an outdated version of iODBC in macOS.)
  2. Build pyodbc with links to iODBC (not its default of UnixODBC, which is not typical for macOS).
  3. Use iODBC Administrator.app (/Applications/iODBC/) to configure ODBC Data Source Names (DSNs), which will be saved to default files:
    • System DSNs: /Library/ODBC/odbc.ini
    • User DSNs: ~/Library/ODBC/odbc.ini
  4. If pyodbc or other tools require $ODBCINI environment variable or similar settings, point them to the file(s) noted above.
  5. Enjoy.
TallTed
  • 9,069
  • 2
  • 22
  • 37
  • Can you clarify the points? Point 1: what did you mean with the Microsoft docs [here](https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/procedure-calls)? Did you infer to run some command in Python, SQL client or some other place to check iODBC to be up-to-date? Point 2: how to build the pyodbc with links to iODBC? Point 3: how to configure the DSNs with iODBC? – hhh Jan 03 '18 at 12:56
  • 1
    (1) I'm sorry; copy-and-paste error. Corrected iODBC URL in answer. (2) That should be another Q&A. (3) Don't use File DSNs until/unless you know they're needed; start with System DSNs. – TallTed Jan 03 '18 at 15:15
  • (1) Thank you. (2) Question now [here](https://stackoverflow.com/questions/48084708/how-to-build-pyodbc-with-links-to-iodbc-in-macos). (3) DSN, [Data Source Name](https://en.wikipedia.org/wiki/Data_source_name)? – hhh Jan 03 '18 at 20:53
  • (3) Yes, DSN is an acronym for Data Source Name. – TallTed Oct 08 '20 at 17:34