This repository is a collection of python based examples that connect to and interact with Dremio. The examples support two main ways to connect to Dremio
- this uses apache flight
- Python version: Python version >= 3.0 is required to use these examples
- Libraries: jaydebeapi and apache adbc are the two prerequisites. To install them run -
python3 -m pip install -r requirements.txt
- Download the JDBC driver (legacy) jar.
- Connection example -
Ensure that either a PAT has been generated or a JWT from an external authentication provider is available
import connection
import pathlib
params = connection.JdbcConnectionParams(
connection.Region.NA, # for North America, or EU for EMEA
token = ...., token_type = connection.JdbcConnectionParams.TokenType.PAT, # for PAT
project_id = ....,
driver_jar = pathlib.Path(....) # path to the jdbc jar file
)
# optionally other parameters can be set like socks proxy etc.
params.set_socks_proxy(host, port, ...)
# connect and interact w/ Dremio
connection = params.connect()
with connection.cursor() as cursor:
while row := cursor.execute(....):
.... # use row
Ensure that a PAT has been generated
import connection
params = connection.AdbcConnectionParams(
connection.Region.NA,
pat=.... # the PAT
)
conn = params.connect()
with conn.cursor() as cur:
...
Or integrate directly with pandas (Refer to Examples for more details)
Refer to Examples for more details