Biblioteca de utilitários essenciais para projetos CSC
Project description
csc-essentials
Pequeno utilitário para integração com Google Cloud (BigQuery, Secret Manager, Cloud Logging, Compute).
Instalação
pip install csc-essentials
Quickstart (exemplo rápido)
from google.cloud import bigquery
from csc_essentials.logging import GeradorLog
from csc_essentials.secrets import get_secrets
from csc_essentials.database import inserir_banco_dados
log = GeradorLog("exemplo")
# Ler segredo do Secret Manager (ex.: token Slack)
raw = get_secrets("projects/MEU_PROJ/secrets/SLACK_SECRET/versions/latest")
# Preparar cliente BigQuery
client = bigquery.Client()
# Carregar arquivo NDJSON para uma tabela
inserir_banco_dados(
arquivo_path="/tmp/dados.ndjson",
projeto="meu-projeto",
dataset="meu_dataset",
tabela="minha_tabela",
log=log,
client=client,
wait_job=True,
)
print("Upload iniciado")
Documentação
- Documentação por módulo em
docs/(vejadocs/overview.md). - Principais módulos:
logging,secrets,utils,database,oracle.
Contribuindo
- Abra uma issue descrevendo o problema ou feature.
- Envie um Pull Request com testes e descrição clara das mudanças.
- Formato de código: siga o estilo existing do projeto e execute os testes (
pytest).
Licença
Este repositório está licenciado conforme o arquivo LICENSE na raiz.
Notas rápidas
- Verifique permissões GCP ao usar
bigquery.Client()esecretmanager.SecretManagerServiceClient. - Em desenvolvimento local, você pode desativar o envio para Cloud Logging configurando
GCP_LOGGING_ATIVO=false.
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
csc_essentials-1.1.3.tar.gz
(16.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csc_essentials-1.1.3.tar.gz.
File metadata
- Download URL: csc_essentials-1.1.3.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff120d8ec0188fb7f6ae8bb87039a65352d7ccc1c8af56e2fa00fe29e357e9f4
|
|
| MD5 |
60a247a27c4a18329b0f98330e96a663
|
|
| BLAKE2b-256 |
e072b918b398afa0dcab948f6a7b88d34fc069c281f54b83e4f49bf69d7ba00b
|
File details
Details for the file csc_essentials-1.1.3-py3-none-any.whl.
File metadata
- Download URL: csc_essentials-1.1.3-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caa20368913e6be002a7e7240ff489d8d3fe1377380899949376cfab52b1d08d
|
|
| MD5 |
2c1560127eca3e5ca174a2e6b732aeed
|
|
| BLAKE2b-256 |
c0c9312478490166ed11276c833ed0c18c8b360d69ecece651274c9c9a82bd38
|