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",
}
]
),
)
Metadata
Release files for vertica-connector-talenttech 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vertica-connector-talenttech-1.2.1.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vertica_connector_talenttech-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / vertica-connector-talenttech-1.2.1.tar.gz
| Download URL | vertica-connector-talenttech-1.2.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfefeda878de6648c8151aea910db1cb96ff865d37a74543b5b0b09d044d5b24
|
|
BLAKE2b-256 checksum How to use checksums |
2bf55361923f21c38e6f7dc786bde9e2d380a0323b1f765f07deeb1b2bf170f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.9.6 requests/2.28.2 setuptools/66.0.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.8.10
|
Release files / vertica_connector_talenttech-1.2.1-py3-none-any.whl
| Download URL | vertica_connector_talenttech-1.2.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d7e19bf2f8c1dbe0a1d9064151bd5098f326d781e36878ff8087242c31b2f4f
|
|
BLAKE2b-256 checksum How to use checksums |
4b3182c2280cf6bd212e78175ae8f5489e7711a828c9ef1e6ec1cfa783390c77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.9.6 requests/2.28.2 setuptools/66.0.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.8.10
|