TopMind Vertica Connector Wrapper
Project description
Customized vertica connector
The Python Wrapper to vertica_python lib for reconnectiong across server nodes
Usage
pip3 install vertica-connector-talenttech
import os
import json
from vconnector.vertica_connector import VerticaConnector
user = "test_user",
password = "test_password"
database = "test_database"
vertica_configs = json.loads(os.getenv("VERTICA_CONFIGS"))
with VerticaConnector(user=user,
password=password,
database=database,
vertica_configs=vertica_configs) as v_connector:
cur = v_connector.cnx.cursor()
sql = "SELECT 1"
cur.execute(sql)
VERTICA_CONFIGS variable structure
{"host": <VERTICA_HOST>,
"port": <VERTICA_PORT>,
"backup_server_node": [<SERVER_NODE_1>, <SERVER_NODE_2>, <SERVER_NODE_3>}
INSERT TABLE EXAMPLE
with VerticaConnector(
user=os.getenv("VERTICA_USER"),
password=os.getenv("VERTICA_PASSWORD"),
database=os.getenv("DATABASE"),
vertica_configs=json.loads(os.getenv("VERTICA_CONFIGS")),
) as v_connector:
cursor = v_connector.cnx.cursor("dict")
cursor.execute("drop table if exists test_staging.test cascade")
cursor.execute(
"""create table netology_staging.test
(
a int,
b varchar(10),
c long varbinary(1000),
d long varchar default MAPTOSTRING(c)
)"""
)
v_connector.insert(
table_name="test",
schema="test_staging",
data=list(
[
{
"a": 1,
"b": "test2",
"c": '[{"x": 1, "y": 2}, {"x": 1, "y": 2}]',
"d": "fuck",
}
]
),
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for vertica-connector-talenttech-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f87e4ab6d59ba95c1e36cacb22eec63a619d502174be3f0b2f347893701e1790 |
|
MD5 | 45c1fff6efd8d3aa0c05e90f4b4c9062 |
|
BLAKE2b-256 | 64ba1bdf853d9b635ef8d6f9560f0ccf61c87ea2cafc133bcaaa6d22e0f84673 |
Close
Hashes for vertica_connector_talenttech-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 192258925e0b3fab3eb7f67ffeb79d6d6e6f9fa580e116f54029f698521f269c |
|
MD5 | 47916f26ef27ec856e84cd8b76da76d1 |
|
BLAKE2b-256 | 49689cb3a4e10b80fb38102d786c6a430912357354b9bc89774142e95043540d |