Install & Compatibility
Where this runs
tested against v0.0.5 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.679s · 42.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.2s · import 0.615s · 41MB
41MB installed
● package 41MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
create_engine
✓ from sqlalchemy import create_engine
The `sqlalchemy-vertica` dialect auto-registers upon installation. You typically only need to import `create_engine` from SQLAlchemy itself and specify the dialect in your connection string.
This quickstart demonstrates how to establish a connection to a Vertica database using `sqlalchemy-vertica` and execute a simple SQL query. Ensure `VERTICA_USER`, `VERTICA_PASSWORD`, `VERTICA_HOST`, `VERTICA_PORT`, and `VERTICA_DATABASE` are correctly configured, preferably via environment variables for production systems.
import os
from sqlalchemy import create_engine, text
# Replace with your actual Vertica connection details
# It's recommended to use environment variables for sensitive info.
VERTICA_USER = os.environ.get("VERTICA_USER", "dbadmin")
VERTICA_PASSWORD = os.environ.get("VERTICA_PASSWORD", "password")
VERTICA_HOST = os.environ.get("VERTICA_HOST", "localhost")
VERTICA_PORT = os.environ.get("VERTICA_PORT", "5432")
VERTICA_DATABASE = os.environ.get("VERTICA_DATABASE", "VMART")
connection_string = (
f"vertica+vertica_python://{VERTICA_USER}:{VERTICA_PASSWORD}"
f"@{VERTICA_HOST}:{VERTICA_PORT}/{VERTICA_DATABASE}"
)
try:
engine = create_engine(connection_string)
with engine.connect() as connection:
# Example: Execute a simple query
result = connection.execute(text("SELECT 1 as test_col"))
print(f"Connection successful! Result: {result.scalar()}")
except Exception as e:
print(f"Failed to connect or execute query: {e}")
Errors
Common errors & fixes
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:vertica.vertica_python
The `sqlalchemy-vertica` package (or its dependency `vertica-python`) is not installed or the Python environment is incorrect.
fixEnsure `pip install sqlalchemy-vertica` has been run in the active Python environment. Verify that `vertica-python` is also installed.
OperationalError: (vertica_python.errors.QueryError) failed to connect: [Errno 111] Connection refused
The Vertica database server is not reachable at the specified host and port, or is not running. This could be due to network issues, incorrect hostname/IP, or an inactive database.
fixCheck the `VERTICA_HOST` and `VERTICA_PORT` in your connection string. Verify network connectivity to the Vertica server and ensure the server is running and accessible.
OperationalError: (vertica_python.errors.QueryError) Password authentication failed for user "your_user"
Incorrect username or password provided in the connection string.
fixDouble-check the `VERTICA_USER` and `VERTICA_PASSWORD` in your connection string for accuracy.
Upgrade
Version history
0.0.5latest on PyPI · released Jan 28, 2020
Audit
Dependencies
SQLAlchemyrequiredCore ORM and SQL expression language.
vertica-pythonrequiredUnderlying Python driver for Vertica connections.