Develop a Python Client Query
Welcome to the Client APIs section of the crash course! So far, you've learned how to use Deephaven from the server itself. If you missed any of the previous sections, check out the links below:
This section of the crash course covers Deephaven Enterprise's client APIs. This guide discusses the Python client, which allows you to:
- Create new workers
- Interact with tables and objects on the server
- Connect to existing Persistent Queries (PQs)
- Create PQs
- Run queries server-side
- And more!
The Enterprise Python client is built on top of the Community Python client, giving you access to its rich feature set.
Installation
Install the Enterprise Python client from the wheel file available in your Deephaven Enterprise installation. If your system administrator has not given you the wheel file directly, you can copy it from the server to your local machine. It is found in the following location on every installation:
Deephaven always recommends the use of virtual environments for local development. Create and use a new virtual environment, and install the wheel with pip:
Alternatively, you may install the Deephaven Core+ client from PyPi:
Only certified builds are published to PyPi. If you are using a pre-release or candidate build, your version may not be available. In that case, you must install the package using the wheel from your Deephaven Core+ installation.
To use the client in Jupyter, also install jupyterlab and deephaven-ipywidgets:
Then activate your venv:
For a list of Enterprise Python client requirements, see the file /usr/illumon/coreplus/latest/py/resources/frozen-requirements-client-1.20240517.344.txt on your Enterprise installation.
Create a session
The first and most important step when using the Python client is to create a session. A session is a connection to the Deephaven server that allows you to authenticate with the server, create tables, PQs, and more. A SessionManager creates a session. It requires one of the following two things to connect to the server:
- A URL to a
connection.jsonfile - A JSON object with the connection details
All Deephaven servers expose a connection.json file. Connecting to a server via this file is simple:
Note
This example uses port 8000. Your server may use a different port. Typically, the port is 8123 for servers without Envoy and 8000 for servers with Envoy.
Authenticate
You should already have login credentials for the server. Use them to authenticate with the server:
Now that you're logged in, you can start doing things with Deephaven!
Use the client
Create a new worker
A common use case for the client is to create a new worker and run queries on it. The following code connects to a new unnamed worker with 4GB of memory:

Run queries on the worker
The Python client has some built-in methods, like ones to consume static and ticking tables:

The client can also run queries on the server:
Workers should be closed once you're done with them:
Connect to a PQ
Instead of creating a new temporary worker, you can also connect to an existing PQ:
Close the SessionManager object
Once your Python code is done performing operations on PQs, close the SessionManager object:
Jupyter
You can also use the Python client from Jupyter. To do so, follow all of the same steps presented in installation, but be sure also to install the deephaven-ipywidgets package, which allows you to display tables and other Deephaven objects in Jupyter.