{"library":"sqlalchemy-vertica-python","title":"SQLAlchemy Vertica Dialect (sqlalchemy-vertica-python)","type":"library","description":"sqlalchemy-vertica-python is a Vertica dialect for SQLAlchemy that utilizes the pure-Python DB-API driver `vertica-python` for database connectivity. It is currently at version 0.6.3, actively maintained by BlueLabs, and typically releases updates to align with SQLAlchemy versions or address bugs.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install sqlalchemy-vertica-python"],"cli":null},"imports":["from sqlalchemy import create_engine"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/bluelabsio/sqlalchemy-vertica-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sqlalchemy-vertica-python/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import os\nfrom sqlalchemy import create_engine, text\n\n# Environment variables for connection details (replace with your Vertica credentials)\nVERTICA_USER = os.environ.get('VERTICA_USER', 'dbadmin')\nVERTICA_PASSWORD = os.environ.get('VERTICA_PASSWORD', 'password')\nVERTICA_HOST = os.environ.get('VERTICA_HOST', 'localhost')\nVERTICA_PORT = os.environ.get('VERTICA_PORT', '5433')\nVERTICA_DB = os.environ.get('VERTICA_DB', 'VMart')\n\n# Construct the connection string\nconnection_string = (\n    f\"vertica+vertica_python://{VERTICA_USER}:{VERTICA_PASSWORD}\"\n    f\"@{VERTICA_HOST}:{VERTICA_PORT}/{VERTICA_DB}\"\n)\n\ntry:\n    # Create an engine instance\n    engine = create_engine(connection_string)\n\n    # Establish a connection\n    with engine.connect() as connection:\n        # Execute a simple query\n        result = connection.execute(text(\"SELECT version();\"))\n        \n        # Fetch and print the result\n        for row in result:\n            print(f\"Connected to Vertica. Version: {row[0]}\")\n\nexcept Exception as e:\n    print(f\"Error connecting to Vertica or executing query: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to establish a connection to a Vertica database using `sqlalchemy-vertica-python` and execute a simple query to retrieve the database version. Ensure your Vertica instance is accessible and replace placeholder credentials with actual environment variables or direct values.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}