Registry / database / pyexasol

pyexasol

JSON →
library2.3.2pypypi✓ verified 27d ago

pyexasol is the officially supported Python connector for Exasol, designed for high-performance data handling with low overhead, fast HTTP transport, and compression. It provides an API for parallel data stream processing, offering significant performance improvements over ODBC/JDBC solutions, especially with `pandas`, `parquet`, and `polars`. The library is actively maintained with a regular release cadence, often seeing monthly or bi-monthly updates.

pip install pyexasol
INSTALL
IMPORT
SIG · PYEXASOL
P
pyexasol
databasepythonv2.3.2
Install
8.2s avg
Import
258ms
Disk
569MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 8.2s
py 3.11
✓ —
✓ 7.85s
py 3.12
✓ —
✓ 7.65s
py 3.13
✓ —
✓ 7.7s
py 3.9
1/2 runs
✓ 9.4s
569MB installed
● package 569MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ExaConnection
from pyexasol import ExaConnection
import pyexasol; pyexasol.ExaConnection()
While `pyexasol.connect()` is a common entry point, `ExaConnection` is the primary class for direct interaction and better type hinting.

This quickstart demonstrates how to establish a connection to an Exasol database, execute DDL and DML statements, and fetch results. It highlights the use of `ExaConnection` and basic SQL operations. For local testing without valid SSL certificates, you might need to adjust `websocket_sslopt` as noted in the code comments. Credentials should ideally be managed via environment variables or a secure configuration.

import os from pyexasol import ExaConnection # Replace with your Exasol connection details or environment variables EXASOL_HOST = os.environ.get('EXASOL_HOST', '127.0.0.1') EXASOL_PORT = os.environ.get('EXASOL_PORT', '8563') EXASOL_USER = os.environ.get('EXASOL_USER', 'sys') EXASOL_PASSWORD = os.environ.get('EXASOL_PASSWORD', 'exasol') try: # Connect to the Exasol database # For production, ensure proper SSL options and fingerprint are used # For local/testing without certs, add: websocket_sslopt={'check_hostname': False, 'verify_mode': 0} # See warnings for v1.0.0 regarding strict certificate verification defaults. con = ExaConnection( dsn=f"{EXASOL_HOST}:{EXASOL_PORT}", user=EXASOL_USER, password=EXASOL_PASSWORD ) print("Successfully connected to Exasol.") # Execute a DDL statement con.execute("CREATE SCHEMA IF NOT EXISTS MY_SCHEMA") con.execute("OPEN SCHEMA MY_SCHEMA") # Execute a DML statement con.execute("CREATE OR REPLACE TABLE my_table (id INT, name VARCHAR(100))") con.execute("INSERT INTO my_table VALUES (1, 'Alice'), (2, 'Bob')") # Fetch data stmt = con.execute("SELECT * FROM my_table ORDER BY id") results = stmt.fetchall() print("Fetched results:", results) # Fetch data into a pandas DataFrame (requires `pyexasol[pandas]`) # import pandas as pd # df = con.export_to_pandas("SELECT * FROM my_table") # print("Fetched into DataFrame:\n", df) except Exception as e: print(f"An error occurred: {e}") finally: if 'con' in locals() and con.is_connected(): con.close() print("Connection closed.")
Debug
Known issues
breakingPython 3.9 support was dropped in PyExasol v2.0.0. Projects using Python 3.9 or older must upgrade their Python version to >=3.10 to use PyExasol v2.0.0 or later.
fix
Upgrade your Python environment to 3.10 or newer.
affects: >=2.0.0
breakingThe `export_params['with_column_names']` parameter for export functions (e.g., `export_to_pandas`) now strictly requires a boolean value. Prior to v2.0.0, its mere presence would be interpreted as `True` regardless of the assigned value.
fix
Ensure `export_params['with_column_names']` is explicitly set to `True` or `False`.
affects: >=2.0.0
breakingFrom PyExasol v1.0.0, strict certificate verification became the default behavior for `pyexasol.connect()` and `ExaConnection`. This changes the default `websocket_sslopt=None` from effectively `{'cert_reqs': ssl.CERT_NONE}` to `{'cert_reqs': ssl.CERT_REQUIRED}`, potentially causing `SSL: CERTIFICATE_VERIFY_FAILED` errors for users not explicitly configuring SSL options. Version 1.0.1 introduced a partial mitigation for fingerprint users.
fix
For production, provide valid SSL certificates via `websocket_sslopt={'ca_certs': 'path/to/cert.pem'}` or use server fingerprints. For development/testing on untrusted networks, consider `websocket_sslopt={'check_hostname': False, 'verify_mode': 0}` (use with caution and never in production).
affects: >=1.0.0
gotchaWhen using `export_to_parquet`, the destination directory (dst) by default must be empty or not exist. If it exists and contains files, an exception may be raised unless `callback_params['existing_data_behavior']` is set to 'overwrite_or_ignore' or 'delete_matching'.
fix
Ensure the `dst` directory is empty, doesn't exist, or explicitly set `callback_params={'existing_data_behavior': 'overwrite_or_ignore'}` (or 'delete_matching') when calling `export_to_parquet`.
affects: >=1.2.0
gotchaWhen exporting data to pandas using `export_to_pandas`, data types might not be perfectly preserved due to differences in Exasol and pandas/NumPy type systems (e.g., Exasol's exact decimals or large integers may map to floats or objects in pandas, potentially losing precision). The underlying mechanism uses CSV export/import.
fix
For critical data type preservation, inspect column types after import. Use `callback_params` to pass custom `dtype` arguments to `pandas.read_csv` if necessary, or use `stmt.fetchall()` and manually construct a DataFrame with explicit dtypes.
affects: All versions
gotchaPyExasol v2.1.0 improved error reporting for `import_from_callback` and `export_to_callback` by wrapping exceptions from various internal threads. Earlier versions might have provided less clear error messages during data transfer failures, making debugging harder.
fix
Upgrade to v2.1.0 or later for enhanced error diagnostics in import/export operations involving callbacks. For older versions, examine logs from HTTP and SQL threads for more context.
affects: <2.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyexasol'
The 'pyexasol' package is not installed in the Python environment where the code is being executed.
fix
pip install pyexasol
ExaConnectionFailedError: Could not connect to Exasol
The client machine cannot establish a network connection to the Exasol database, often due to an incorrect DSN (host or port), firewall restrictions, or the database being offline.
fix
Verify the DSN (host and port), check network connectivity (e.g., using 'telnet <host> 8563'), ensure the Exasol database is running, and confirm the client's IP address is allow-listed if connecting to Exasol SaaS.
OperationalError: database error [08004] Connection exception - Client connection must be encrypted.
The Exasol database is configured to only accept encrypted connections, but the pyexasol client is attempting to connect without encryption enabled.
fix
Explicitly set `encryption=True` in the `pyexasol.connect()` call: `pyexasol.connect(dsn='...', user='...', password='...', encryption=True)`.
ssl.SSLEOFError: EOF occurred in violation of protocol
An issue with the SSL/TLS handshake between the client and the Exasol server, often due to an outdated OpenSSL version, invalid certificates, or network intermediaries interfering with the SSL connection.
fix
Update OpenSSL on the client machine, ensure proper TLS/SSL certificate setup (e.g., using trusted CA certificates or fingerprint verification), or, for testing purposes, disable certificate verification (though this is not recommended for production).
TypeError: cannot serialize '_io.FileIO' object
This error typically occurred on Windows systems in older pyexasol versions (before 0.3.23) when using `export_to_pandas`, due to Python's `multiprocessing` module's limitations in serializing file-like objects across processes.
fix
Upgrade the `pyexasol` package to version `0.3.23` or higher using `pip install --upgrade pyexasol`.
Upgrade
Version history
2.3.2latest on PyPI · released Aug 25, 2026
Audit
Dependencies
cryptographyrequiredRequired for secure connections (TLS/SSL certificate validation and RSA operations). Replaced the 'rsa' dependency in v2.0.0.
websocket-clientrequiredCore dependency for the WebSocket protocol-based communication with Exasol.
pandasoptionalOptional, for `export_to_pandas` and `import_from_pandas` functionality.
pyarrowoptionalOptional, for `export_to_parquet` and `import_from_parquet` functionality.
polarsoptionalOptional, for integration with Polars DataFrames.
orjsonoptionalOptional, for faster JSON serialization/deserialization.
Agent activity
22 hits · last 30 days
node
20
Resources