Библиотека для вставки в таблицы, используя промежуточную
Типы СУБД для вставки:
- clickhouse
- vertica
Аргументы :
- script - код для вставки, тип: string
- sql_credentials - sql-креды для вставки, тип: json
- insert_table - имя таблицы, в которую идет вставка, тип: string
- add_args - аргументы для замены переменных в скрипте, тип: json
Usage
pip3 install swap-inserter-talenttech-oss
SQL CREDENTIALS:
sql_credentials = {
"vertica": {
"database": <VERTICA_DATABASE>,
"schema": <VERTICA_SCHEMA>,
"staging_schema": <VERTICA_STAGING_SCHEMA>,
"user": <VERTICA_WRITE_USER>,
"host": <VERTICA_HOST>,
"port": <VERTICA_PORT>,
"password": <VERTICA_WRITE_PASSWORD>,
"vertica_configs": {"host": <VERTICA_HOST>,
"port": <VERTICA_PORT>,
"backup_server_node": [<SERVER_NODE_1>, <SERVER_NODE_2>, <SERVER_NODE_3>},
},
"ch": {
"database": <CH_DATABASE>,
"user": <CH_WRITE_USER>,
"host": <CH_HOST_A>,
"port": <CH_PORT_TCP>,
"password": <CH_WRITE_PASSWORD>,
"alt_hosts": "{},{}:{}".format(
<CH_HOST_B>,
<CH_HOST_C>,
<CH_PORT_TCP>,
),
},
}
ПРИМЕР ИСПОЛЬЗОВАНИЯ VERTICA:
from inserter.vertica_swap_inserter import VerticaSwapInserter
script = "SELECT <FIELDS> FROM {schema}.{from_table}"
inserter = VerticaSwapInserter(
script=script,
sql_credentials=sql_credentials["vertica"],
insert_table=<TABLE_INSERT>,
add_args={
"schema": sql_credentials["vertica"]["schema"],
"from_table": <FROM_TABLE>
}
)
inserter.run()
ПРИМЕР ИСПОЛЬЗОВАНИЯ CH:
from inserter.ch_swap_inserter import CHSwapInserter
script = "SELECT <FIELDS> FROM {schema}.{from_table}"
inserter = CHSwapInserter(
script=script,
sql_credentials=sql_credentials["ch"],
insert_table=<TABLE_INSERT>,
add_args={
"database": sql_credential["ch"]["database"],
"from_table": <FROM_TABLE>
},
)
inserter.run()
Metadata
Release files for swap-inserter-talenttech-oss 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swap-inserter-talenttech-oss-0.0.4.tar.gz | 4.4 kB | Without provenance | Details for swap-inserter-talenttech-oss-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swap_inserter_talenttech_oss-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for swap_inserter_talenttech_oss-0.0.4-py3-none-any.whl |
Total release size: 10.3 kB
Release files / swap-inserter-talenttech-oss-0.0.4.tar.gz
| Download URL | swap-inserter-talenttech-oss-0.0.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d5163b5e77123df7ece863338529ad4e3c155cf4a147cd578ad879601b88d88
|
|
BLAKE2b-256 checksum How to use checksums |
7114b75e68f3661a44843c70e6cc8b447a887fcc2552fa007282144ef6b99c2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.15
|
Release files / swap_inserter_talenttech_oss-0.0.4-py3-none-any.whl
| Download URL | swap_inserter_talenttech_oss-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e65a95c38294cba0d8074e34015182168c9e8fab044652742a32cfa13682876c
|
|
BLAKE2b-256 checksum How to use checksums |
bfd681f290733804bfc677d88cf029dfc913010d5900eddecb2a340ac0ed32ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.15
|
Security for swap-inserter-talenttech-oss 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.