pyvertica

raw JSON →
1.6.1 verified Fri May 01 auth: no python maintenance

Tools for performing batch imports into Vertica. Current version 1.6.1, last released in 2015, maintained in low activity mode.

pip install pyvertica
error ImportError: No module named vertica
cause Importing from the wrong module name; correct module is pyvertica.
fix
Use the correct import: from pyvertica import VerticaPipe
error TypeError: string indices must be integers
cause Passing a string as the query or data when executemany expects a tuple/list.
fix
Ensure executemany('INSERT INTO t (c) VALUES (:1)', [(1,)]) uses a sequence of tuples.
deprecated pyvertica last updated in 2015; unmaintained for years. May not support modern Python (3.6+). Recommended replacement is vertica-python.
fix Migrate to vertica-python library for active support and Python 3 compatibility.
gotcha Uses psycopg2 under the hood; Vertica's JDBC/ODBC drivers not required but the Vertica server must be configured to accept PostgreSQL wire protocol connections (default on port 5433).
fix Ensure Vertica database is listening on a port with PostgreSQL protocol enabled.

Basic batch insert using VerticaPipe and parameterized queries.

from pyvertica import VerticaPipe
import os

conn_params = {
    'host': os.environ.get('VERTICA_HOST', 'localhost'),
    'port': 5433,
    'user': os.environ.get('VERTICA_USER', 'dbadmin'),
    'password': os.environ.get('VERTICA_PASSWORD', ''),
    'database': os.environ.get('VERTICA_DB', 'vdb')
}

with VerticaPipe(**conn_params) as pipe:
    pipe.executemany(
        "INSERT INTO test_table (id, name) VALUES (:1, :2)",
        [(1, 'Alice'), (2, 'Bob')]
    )
    pipe.commit()