Python
Python integration using Dremio ODBC Drivers for Linux, OSX, and Windows.
Requirements
- Python 2.7+ or 3+ with pandas, unixODBC and pyodbc
- Dremio Linux ODBC Driver
Using the pyodbc Package
The following code demonstrates connecting to a dataset with path foo.bar
using pyodbc and loading it into a pandas dataframe. For the host, enter the IP address for one of the coordinator nodes in your cluster.
The driver string depends on your operating system. If on Windows, use Dremio Connector
, on Linux use Dremio ODBC Driver 64-bit
or Dremio ODBC Driver 32-bit
depending on your OS, and on OSX use Dremio ODBC Driver
.
import pyodbc, pandas
host = <enter host>
port = 31010
uid = <enter username>
pwd = <enter password>
driver = <enter driver based on OS>
cnxn = pyodbc.connect("Driver={};ConnectionType=Direct;HOST={};PORT={};AuthenticationType=Plain;UID={};PWD={}".format(driver, host,port,uid,pwd),autocommit=True)
sql = '''SELECT * FROM foo.bar'''
dataframe = pandas.read_sql(sql,cnxn)