Skip to main content

mtpk_postgres

Adaptación a Postgres (vía psycopg 3) de mtpk_mariadb: define tus tablas con dataclasses (Tabla, Columna, ForeignKey, Index), sincroniza la estructura de la base de datos automáticamente (CREATE/ALTER TABLE, índices, claves foráneas) y usa AsyncCrudBase para CRUD asíncrono.

No modifica ni depende de mtpk_mariadb; es un paquete independiente. Ver docs/mtpk-postgres-adaptacion.md en el repo para el detalle de las diferencias frente a la versión MariaDB.

Instalación

pip install -e .

Notas de la adaptación

  • Identificadores citados con "comillas dobles" en vez de backticks.
  • auto_increment=True genera GENERATED ALWAYS AS IDENTITY en vez de AUTO_INCREMENT; como Postgres no tiene lastrowid, las inserciones vía AsyncCrudBase.insert()/insertar() añaden RETURNING id.
  • Tabla.to_sql() ya no incluye índices ni comentarios inline (Postgres no lo permite dentro de CREATE TABLE): usa Tabla.to_sql_indices() y Tabla.to_sql_comentarios() para las sentencias CREATE INDEX y COMMENT ON correspondientes. ManagerDB ya las ejecuta automáticamente al crear tablas.
  • ENUM/SET se traducen a TEXT + CHECK; al reconstruir la estructura desde la base de datos ambos se reportan como ENUM (Postgres no permite distinguirlos después del hecho).
  • A diferencia de MariaDB, el DDL en Postgres es transaccional: los métodos de ManagerDB confirman (COMMIT) explícitamente tras crear tablas, triggers y procedimientos.

Historial

  • 0.1.1: corrige un bug bloqueante — Tabla no enlazaba indice.tabla/fk.tabla/columna.tabla cuando columnas/indices/foreign_keys se pasaban directamente por el constructor (solo lo hacían add_index() y compañía). Como Index.to_sql() necesita esa referencia para generar el CREATE INDEX, cualquier tabla definida de la forma normal y con al menos un índice fallaba con ValueError al sincronizar el esquema. Se añadió Tabla.__post_init__ para enlazarlos siempre.
  • 0.1.0: primera versión publicada.

Metadata

Release files for mtpk-postgres 0.1.1

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

Source distribution (sdist)

Source distribution for mtpk-postgres 0.1.1
File Size Uploaded Provenance Actions
mtpk_postgres-0.1.1.tar.gz 31.2 kB Without provenance Details for mtpk_postgres-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mtpk-postgres 0.1.1
File Interpreter ABI Platform Actions
mtpk_postgres-0.1.1-py3-none-any.whl Python 3 none any Details for mtpk_postgres-0.1.1-py3-none-any.whl

Total release size: 63.9 kB

Release files / mtpk_postgres-0.1.1.tar.gz

Download URL mtpk_postgres-0.1.1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
575a5e887e7537bc8b351909e8c8f6d496dc0577c6eb9c72abe8fed4b0875752
BLAKE2b-256 checksum
How to use checksums
9669357a8e3821f5823ca7f59a2e597a3c551bba059e3251f1eaa57b3daf4241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / mtpk_postgres-0.1.1-py3-none-any.whl

Download URL mtpk_postgres-0.1.1-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c18d9655cf2e4033c792fbdd672257a1dbbdd490fa49dd183628b545122aff89
BLAKE2b-256 checksum
How to use checksums
1cae4cb1294b1a4d38698f915d6a1e9a4d12e4e847ccfc4bc4c4752a248cb8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for mtpk-postgres 0.1.1

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