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.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41956909bfe91d360dd613d495f39c139b679549f51495f26468ded5bf9605c |
|
MD5 | a737c93b0fee9579e4c08c1c034f47a2 |
|
BLAKE2b-256 | 2fd6751c8673a29e0e7c555ef3c3b348965eec300e902ea723064827245b62e5 |
Close
Hashes for vertica_connector_talenttech-1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12de9d9b59b36a5132a305bca694e33fd1b3c3658276a694213f2c7b236d4163 |
|
MD5 | a09ec5121afad881533be9e5541be3aa |
|
BLAKE2b-256 | c803e1915eb09c114f1509163e185c805f57edd53a844f8f97732e7d36d0c82f |