mtpk-postgres 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/PKG-INFO +10 -1
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/README.md +9 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/__init__.py +1 -1
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/core_sync.py +12 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres.egg-info/PKG-INFO +10 -1
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/pyproject.toml +1 -1
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/LICENSE +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/async_adapter.py +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/crud.py +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/excepciones.py +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/interface.py +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres/utils.py +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres.egg-info/SOURCES.txt +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres.egg-info/dependency_links.txt +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres.egg-info/requires.txt +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/mtpk_postgres.egg-info/top_level.txt +0 -0
- {mtpk_postgres-0.1.0 → mtpk_postgres-0.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mtpk_postgres
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Librería para sincronización estructural de bases de datos Postgres con modelos Python (adaptación de mtpk_mariadb)
|
|
5
5
|
Author-email: José Jesús Andrés Zambrana <jjandres@multiplika.es>
|
|
6
6
|
License: MIT
|
|
@@ -45,3 +45,12 @@ pip install -e .
|
|
|
45
45
|
reportan como `ENUM` (Postgres no permite distinguirlos después del hecho).
|
|
46
46
|
- A diferencia de MariaDB, el DDL en Postgres es transaccional: los métodos de `ManagerDB` confirman (`COMMIT`)
|
|
47
47
|
explícitamente tras crear tablas, triggers y procedimientos.
|
|
48
|
+
|
|
49
|
+
## Historial
|
|
50
|
+
|
|
51
|
+
- **0.1.1**: corrige un bug bloqueante — `Tabla` no enlazaba `indice.tabla`/`fk.tabla`/`columna.tabla` cuando
|
|
52
|
+
`columnas`/`indices`/`foreign_keys` se pasaban directamente por el constructor (solo lo hacían `add_index()` y
|
|
53
|
+
compañía). Como `Index.to_sql()` necesita esa referencia para generar el `CREATE INDEX`, cualquier tabla definida
|
|
54
|
+
de la forma normal y con al menos un índice fallaba con `ValueError` al sincronizar el esquema. Se añadió
|
|
55
|
+
`Tabla.__post_init__` para enlazarlos siempre.
|
|
56
|
+
- **0.1.0**: primera versión publicada.
|
|
@@ -25,3 +25,12 @@ pip install -e .
|
|
|
25
25
|
reportan como `ENUM` (Postgres no permite distinguirlos después del hecho).
|
|
26
26
|
- A diferencia de MariaDB, el DDL en Postgres es transaccional: los métodos de `ManagerDB` confirman (`COMMIT`)
|
|
27
27
|
explícitamente tras crear tablas, triggers y procedimientos.
|
|
28
|
+
|
|
29
|
+
## Historial
|
|
30
|
+
|
|
31
|
+
- **0.1.1**: corrige un bug bloqueante — `Tabla` no enlazaba `indice.tabla`/`fk.tabla`/`columna.tabla` cuando
|
|
32
|
+
`columnas`/`indices`/`foreign_keys` se pasaban directamente por el constructor (solo lo hacían `add_index()` y
|
|
33
|
+
compañía). Como `Index.to_sql()` necesita esa referencia para generar el `CREATE INDEX`, cualquier tabla definida
|
|
34
|
+
de la forma normal y con al menos un índice fallaba con `ValueError` al sincronizar el esquema. Se añadió
|
|
35
|
+
`Tabla.__post_init__` para enlazarlos siempre.
|
|
36
|
+
- **0.1.0**: primera versión publicada.
|
|
@@ -283,6 +283,18 @@ class Tabla:
|
|
|
283
283
|
database: Optional["Database"] = None
|
|
284
284
|
db_name: Optional[str] = None # ← nuevo campo, sin conflicto con Database
|
|
285
285
|
|
|
286
|
+
def __post_init__(self):
|
|
287
|
+
# Index.to_sql() necesita conocer su tabla (Postgres genera el CREATE INDEX aparte,
|
|
288
|
+
# no como cláusula del CREATE TABLE) — sin esto, pasar columnas/indices/foreign_keys
|
|
289
|
+
# por el constructor (en vez de add_columna/add_index/add_foreign_key) los deja sin
|
|
290
|
+
# enlazar a self y provoca un ValueError en cuanto la tabla tiene algún índice.
|
|
291
|
+
for col in self.columnas:
|
|
292
|
+
col.tabla = self
|
|
293
|
+
for idx in self.indices:
|
|
294
|
+
idx.tabla = self
|
|
295
|
+
for fk in self.foreign_keys:
|
|
296
|
+
fk.tabla = self
|
|
297
|
+
|
|
286
298
|
def add_columna(self, columna: Columna):
|
|
287
299
|
"""
|
|
288
300
|
Añade una columna a la tabla si no existe ya.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mtpk_postgres
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Librería para sincronización estructural de bases de datos Postgres con modelos Python (adaptación de mtpk_mariadb)
|
|
5
5
|
Author-email: José Jesús Andrés Zambrana <jjandres@multiplika.es>
|
|
6
6
|
License: MIT
|
|
@@ -45,3 +45,12 @@ pip install -e .
|
|
|
45
45
|
reportan como `ENUM` (Postgres no permite distinguirlos después del hecho).
|
|
46
46
|
- A diferencia de MariaDB, el DDL en Postgres es transaccional: los métodos de `ManagerDB` confirman (`COMMIT`)
|
|
47
47
|
explícitamente tras crear tablas, triggers y procedimientos.
|
|
48
|
+
|
|
49
|
+
## Historial
|
|
50
|
+
|
|
51
|
+
- **0.1.1**: corrige un bug bloqueante — `Tabla` no enlazaba `indice.tabla`/`fk.tabla`/`columna.tabla` cuando
|
|
52
|
+
`columnas`/`indices`/`foreign_keys` se pasaban directamente por el constructor (solo lo hacían `add_index()` y
|
|
53
|
+
compañía). Como `Index.to_sql()` necesita esa referencia para generar el `CREATE INDEX`, cualquier tabla definida
|
|
54
|
+
de la forma normal y con al menos un índice fallaba con `ValueError` al sincronizar el esquema. Se añadió
|
|
55
|
+
`Tabla.__post_init__` para enlazarlos siempre.
|
|
56
|
+
- **0.1.0**: primera versión publicada.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mtpk_postgres"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.1"
|
|
8
8
|
description = "Librería para sincronización estructural de bases de datos Postgres con modelos Python (adaptación de mtpk_mariadb)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|