Skip to main content

📦 LoadData & DataContractValidator

Este módulo proporciona utilidades para:

  • Carga de datos en PostgreSQL
  • Generación de identificadores únicos
  • Validación de contratos de datos
  • Manejo de fechas

🧱 Clase: LoadData

Clase principal para gestionar la carga de datos en base de datos PostgreSQL.

🔌 enginepsql()

Crea y devuelve un engine de conexión a PostgreSQL usando variables de entorno:

  • USUARIO
  • PASSWORD
  • HOSTNAME
  • PORT
  • DATABASE

🧹 truncate_table(schema, table)

Trunca una tabla sin eliminar su estructura:

  • Desactiva triggers (FKs)
  • Ejecuta TRUNCATE
  • Reactiva triggers

🆔 unique_id_()

Genera un identificador único (unique_id) para cada fila del DataFrame:

  • Usa columnas definidas en uid_cols
  • Limpia strings (lowercase, sin acentos ni caracteres especiales)
  • Genera hash SHA256 → entero int64

📥 load_all_data(...)

Carga datos en PostgreSQL.

Parámetros:

  • input_table: DataFrame a cargar
  • output_table: schema.table
  • uid_cols: columnas para generar ID único
  • uid_need: columna ya existente como ID
  • truncate: si True, borra la tabla antes

Comportamiento:

  • 🔁 Carga incremental (default):

    • Genera unique_id
    • Convierte datos a polars
    • Realiza anti-join para evitar duplicados
  • 🧨 Carga completa (truncate=True):

    • Trunca tabla
    • Inserta todos los datos
  • 🆕 Si la tabla no existe:

    • La crea automáticamente

📊 reportar_datos_aniadidos()

Imprime en consola el número de filas insertadas:

{"datos_aniadidos": X}

Metadata

Release files for loaddata 1.1.6

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

Built distribution (wheel)

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

Release files / loaddata-1.1.6-py3-none-any.whl

Download URL loaddata-1.1.6-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c78822db012cdfd6ebbb3665d0931cac53427211493b0bbcffc3886414eee7e
BLAKE2b-256 checksum
How to use checksums
9f7430c4f821e0c3a8ab1926321b2acbb07ba3090ff29c65df05a6bd7ccd2785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for loaddata 1.1.6

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.

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