Silver ⭐️⭐️⭐️
May 21, 2020
How to connect to CDP Impala from python
- October 5, 2026 at 8:50 AM
- 3 replies
- 41438 views
- Translate All
Continuing my series of how-to articles for CDP, today we explore how to connect to Impala via JDBC in JSON. In my example, I will use a Jupyter notebook running in CML, but this can be generalized.
This process is actually fairly easy, so let's dive in.
Step 1: Setup Impala JDBC drivers
- First, download the latest impala JDBC drivers from Cloudera JDBC Driver 2.6.17 for Impala.
- Then, upload them to your machine. Here is an example of a CML Jupyter sessions with the jars uploaded:

- Finally, make sure that you set up your CLASSPATH properly by opening a terminal session and typing the following:
CLASSPATH=.:/home/cdsw/ImpalaJDBC4.jar:/home/cdsw/ImpalaJDBC41.jar:/home/cdsw/ImpalaJDBC42.jar
export CLASSPATH
Step 2: Install JayDeBeApi
- To install JayDeBeApi, run the following:
pip3 install JayDeBeApi - A recommended step to avoid getting an error along the lines of "AttributeError: type object 'java.sql.Types' has no attribute '__javaclass__'", would be to downgrade your jpype by running the following:
pip3 install --upgrade jpype1==0.6.3 --user - Restart your kernel when you perform the downgrade.
Step 3: Connect to Impala
- Finally, connect to your impala, using the following sample code:
import jaydebeapi
conn = jaydebeapi.connect("com.cloudera.impala.jdbc.DataSource",
"jdbc:impala://[your_host]:443/;ssl=1;transportMode=http;httpPath=icml-data-mart/cdp-proxy-api/impala;AuthMech=3;",
{'UID': "[your_cdp_user]", 'PWD': "[your_workload_pwd]"},
'/home/cdsw/ImpalaJDBC41.jar')
curs = conn.cursor()
curs.execute("select * from default.locations")
curs.fetchall()
curs.close()
conn.close()
Note: You can get your impala JDBC string either from the Datahub endpoint path or from the JDBC URL from CDW.
The following is a screenshot of my code in action:

