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.4.tar.gz
(16.8 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.4.tar.gz.
File metadata
- Download URL: csc_essentials-1.1.4.tar.gz
- Upload date:
- Size: 16.8 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 |
65ec0e18d7e1f2ebf08898b0ae9ae3f5d62dad4b44801079cdbe34c6d741460e
|
|
| MD5 |
19ad2ecbe9e130cfe21a727c22975d84
|
|
| BLAKE2b-256 |
693bc28d3d97d1c7b13291b2f03d64eb3f279f67df38412b38b3aaa9197f5367
|
File details
Details for the file csc_essentials-1.1.4-py3-none-any.whl.
File metadata
- Download URL: csc_essentials-1.1.4-py3-none-any.whl
- Upload date:
- Size: 17.8 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 |
6777aeea3268398a3d2e3194a5d77262b418c26346604ad8808280ac72de01d6
|
|
| MD5 |
32b20fc4f11e0ab4d065b3ae37b700fa
|
|
| BLAKE2b-256 |
ac427cc1e8dc6606be4733469fc2ee669590f9d5751948eb4c91b9321a620e20
|