Skip to main content

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/ (veja docs/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() e secretmanager.SecretManagerServiceClient.
  • Em desenvolvimento local, você pode desativar o envio para Cloud Logging configurando GCP_LOGGING_ATIVO=false.

Project details


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.2.2.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csc_essentials-1.2.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file csc_essentials-1.2.2.tar.gz.

File metadata

  • Download URL: csc_essentials-1.2.2.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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

Hashes for csc_essentials-1.2.2.tar.gz
Algorithm Hash digest
SHA256 48ea329c8e11291e02d5d4cac17a4db5733eb5cdb52e9dc9f69153f90152d906
MD5 0a6339b87f071c3280c95e814776ca87
BLAKE2b-256 1e42e36d1acffe115ac30eaf470a0a7f200675f9be45202a3d19e58c4a65d891

See more details on using hashes here.

File details

Details for the file csc_essentials-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: csc_essentials-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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

Hashes for csc_essentials-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79df5a5a86a564dc4c0df4dc7d79fcf4d0bf8723a17bb08b884928bd86d5e73c
MD5 73e28cc6cfa0b19665a19e6f9291da44
BLAKE2b-256 bd680a6cef4f4ddc8f7265fa7988068e89a31ee1530974a9d82db81056aa4495

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page