Skip to main content

servify

Biblioteca Python para leitura de dados (xlsx/csv/json/parquet/delta/tabelas) em ambientes Databricks, com detecção automática de encoding/delimitador/JSON multiline e logging integrado.

Instalação

pip install servify

Uso rápido

import servify as sf

df = sf.read_data(
    "/Volumes/meu_catalogo/meu_schema/volume/arquivo.csv", "csv")

Para arquivos XLSX, o schema é opcional. Quando não informado, a lib usa a primeira linha como cabeçalho e infere automaticamente os tipos das colunas:

df = sf.read_data(
    "/Volumes/meu_catalogo/meu_schema/volume/arquivos_xlsx/", "xlsx")

Normalização

As normalizações são acessadas pela fachada sf.normalization. Para strings, as colunas são opcionais e, quando omitidas, todas as colunas string são tratadas. Para os demais tipos, informe a lista de colunas. Datas também precisam do formato:

df = sf.normalization(df, "strings")
df = sf.normalization(df, "int", columns=["idade"])
df = sf.normalization(df, "float", columns=["salario"])
df = sf.normalization(
    df,
    "date",
    columns=["data_nascimento"],
    formato="dd/MM/yyyy",
)
df = sf.normalization(
    df,
    "timestamp",
    columns=["criado_em"],
    formato="yyyy-MM-dd HH:mm:ss",
)

Configuração (opcional)

Antes de chamar sf.read_data(...), o usuário pode ajustar as opções abaixo diretamente em sf.<opção> = valor:

import servify as sf

sf.show_options()  # lista todas as opções disponíveis e o valor atual de cada uma

sf.LOG_ENABLED = True                    # exibe logs no terminal (default: False)
sf.PERSIST_LOGS_CATALOG = "meu_catalogo" # catalog do Unity Catalog p/ persistir logs
sf.PERSIST_LOGS_SCHEMA = "meu_schema"    # schema do Unity Catalog p/ persistir logs
sf.PERSIST_LOGS = True                   # persiste logs em tabela Delta (default: False)
sf.PERSIST_LOG_MIN_LEVEL = "ERROR"       # nível mínimo persistido (default: "WARNING")

df = sf.read_data(
    "/Volumes/meu_catalogo/meu_schema/volume/arquivo.csv", "csv")
Opção Tipo Default Observação
LOG_ENABLED bool False Exibe logs no terminal.
PERSIST_LOGS bool False Persiste logs em tabela Delta do Unity Catalog.
PERSIST_LOGS_CATALOG str None Necessário antes de PERSIST_LOGS = True.
PERSIST_LOGS_SCHEMA str None Necessário antes de PERSIST_LOGS = True.
PERSIST_LOG_MIN_LEVEL str "WARNING" DEBUG, INFO, WARNING, ERROR ou CRITICAL.

O que acontece se catalog / schema não forem informados?

Se sf.PERSIST_LOGS = True for definido sem PERSIST_LOGS_CATALOG e PERSIST_LOGS_SCHEMA já preenchidos, a lib não levanta exceção: ela imprime um aviso ([WARN] persist_logs não habilitado: ...) e mantém PERSIST_LOGS como False até que ambos sejam definidos. Ou seja, o comportamento padrão (sem persistência) continua funcionando normalmente; a persistência em Delta é sempre opt-in e só é ativada quando catalog e schema estão presentes.

import servify as sf

sf.PERSIST_LOGS = True

# [WARN] persist_logs não habilitado: informe 'catalog' e 'schema' do Unity
# Catalog (ex.: sf.PERSIST_LOGS_CATALOG e sf.PERSIST_LOGS_SCHEMA) antes de
# sf.PERSIST_LOGS = True.

sf.PERSIST_LOGS_CATALOG = "meu_catalogo"
sf.PERSIST_LOGS_SCHEMA = "meu_schema"

sf.PERSIST_LOGS = True  # agora habilita normalmente

Licença

MIT

Metadata

Release files for servify 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for servify 0.1.18
File Size Uploaded Provenance Actions
servify-0.1.18.tar.gz 31.3 kB Without provenance Details for servify-0.1.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for servify 0.1.18
File Interpreter ABI Platform Actions
servify-0.1.18-py3-none-any.whl Python 3 none any Details for servify-0.1.18-py3-none-any.whl

Total release size: 78.8 kB

Release files / servify-0.1.18.tar.gz

Download URL servify-0.1.18.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
963659c4e3bc1cf9b95e179ba56dcd95a1cb37b3cad827914e17c5cbd74bee53
BLAKE2b-256 checksum
How to use checksums
1cecd45727ae858d920581765574677386739ff282b405d9ca956062bcba790d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / servify-0.1.18-py3-none-any.whl

Download URL servify-0.1.18-py3-none-any.whl
Size 47.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6699ee23a55600b9e45953addec7554935b471b9e74704e7cf4dbd0cb093210
BLAKE2b-256 checksum
How to use checksums
79ea638d1ea3fa49994c51786069a5a8c2be47fd9d11b6d3658f14ee4c164ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Security for servify 0.1.18

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.

Release history Release notifications | RSS feed

This release

0.1.18 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page