Skip to content

aniket-s-kulkarni/dremio-python-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

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

  1. JDBC driver (legacy)
  2. Apache ADBC driver
  • this uses apache flight

Prerequisites

  1. Python version: Python version >= 3.0 is required to use these examples
  2. Libraries: jaydebeapi and apache adbc are the two prerequisites. To install them run -
python3 -m pip install -r requirements.txt

Connecting to Dremio

JDBC

  1. Download the JDBC driver (legacy) jar.
  2. 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

ADBC

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)

Notebook

Refer to Examples for more details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published