📦 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:
USUARIOPASSWORDHOSTNAMEPORTDATABASE
🧹 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 cargaroutput_table:schema.tableuid_cols: columnas para generar ID únicouid_need: columna ya existente como IDtruncate: siTrue, borra la tabla antes
Comportamiento:
-
🔁 Carga incremental (default):
- Genera
unique_id - Convierte datos a
polars - Realiza
anti-joinpara evitar duplicados
- Genera
-
🧨 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.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loaddata-1.1.5.tar.gz | 8.2 kB | Without provenance | Details for loaddata-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loaddata-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for loaddata-1.1.5-py3-none-any.whl |
Total release size: 16.0 kB
Release files / loaddata-1.1.5.tar.gz
| Download URL | loaddata-1.1.5.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca90d6de64bc66ec2d3a1b344742bef01e957070fc60c5c679c0c3dad515fe20
|
|
BLAKE2b-256 checksum How to use checksums |
add1b60f782f7cab9d0ae651e3f7178603f9e7640e0e9ed1d5b13ae3f7a4b87d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / loaddata-1.1.5-py3-none-any.whl
| Download URL | loaddata-1.1.5-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79950e030ee8a1c903ae8c07fb002fe71aa65a4af1249054dc05f8fc8650ef48
|
|
BLAKE2b-256 checksum How to use checksums |
22b36dce2df04e16edd491fd5797966c7dafe4932aea3241fc749e7b54a076d1
|
| 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.5
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.