Registry / database / sqlalchemy-vertica

sqlalchemy-vertica

JSON →
library0.0.5pypypi✓ verified 85d ago

SQLAlchemy-Vertica provides a dialect for connecting SQLAlchemy to Vertica databases, leveraging the `vertica-python` driver. It allows users to interact with Vertica using SQLAlchemy's ORM and SQL Expression Language. The current version is 0.0.5, and the project appears to be in maintenance mode with infrequent updates.

pip install sqlalchemy-vertica
INSTALL
IMPORT
SIG · SQLALCHEMY-VERTICA
S
sqlalchemy-vertica
databasepythonv0.0.5
Install
3.2s avg
Import
647ms
Disk
41MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.679s · 42.7MB
glibc
py 3.103.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}")
Debug
Known issues
gotchaThe `sqlalchemy-vertica` dialect has not been actively developed since 2021 (v0.0.5). It may not fully support newer features of SQLAlchemy (e.g., 2.0+ specific patterns) or be compatible with very recent Vertica database versions. Users should test thoroughly if using with latest SQLAlchemy or Vertica releases.
fix
Review GitHub issues/PRs for similar problems or consider contributing fixes. Test against your specific SQLAlchemy and Vertica versions.
affects: <=0.0.5
gotchaVertica's specific data type behaviors, such as `TEXT` often behaving like `VARCHAR(MAX)` or character sets, might lead to unexpected mapping issues with SQLAlchemy's generic types. Explicit type casting or using `sqlalchemy.types.VARCHAR` with a length might be necessary.
fix
For specific column definitions, explicitly define `sqlalchemy.types` (e.g., `Column('name', String(255))`) instead of relying solely on inferred types.
affects: <=0.0.5
gotchaVertica includes non-standard SQL constructs (e.g., `COPY` statements, `CREATE TABLE AS SELECT WITH NO DATA`). These are typically not directly supported by SQLAlchemy's ORM and often require executing raw SQL using `connection.execute(text('YOUR VERTICA SQL HERE'))`.
fix
When using Vertica-specific SQL, wrap your statement in `sqlalchemy.text()` and execute it directly via the connection.
affects: <=0.0.5
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.
fix
Ensure `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.
fix
Check 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.
fix
Double-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.
Agent activity
16 hits · last 30 days
node
10
OpenAI (training)
2
Meta
1
Resources
sqlalchemy-vertica — pip install sqlalchemy-vertica · libregistry