python-general-be-lib 0.10.0__py3-none-any.whl → 0.10.0.post2__py3-none-any.whl

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.
@@ -17,12 +17,19 @@ class TimestampMixin:
17
17
  ``TIMESTAMP WITH TIME ZONE``, on the backends that ignore the flag the column is a
18
18
  plain timestamp and the value is the one the database produces.
19
19
 
20
- ``create_date`` is filled by a **server-side** default, so it is correct even for rows
21
- inserted outside the library, by a migration or by hand. ``write_date`` is refreshed by
22
- ``onupdate``, which SQLAlchemy adds to the UPDATE statement it builds: it therefore
23
- covers ``CrudRepository.update`` and ``upsert``, and does **not** cover a raw SQL
24
- UPDATE run outside the library — that would need a database trigger, which a mixin
25
- cannot install.
20
+ Both timestamps carry **two** defaults, and both are needed. ``server_default`` is a
21
+ DDL clause: it ends up in the ``CREATE TABLE`` and covers the rows inserted outside the
22
+ library, by a migration or by hand — but only on the tables the library creates
23
+ afterwards. On a table that already exists the column has no such clause, and since
24
+ SQLAlchemy omits a ``server_default`` column from the INSERT expecting the database to
25
+ fill it, the write would fail on the ``NOT NULL``. The ``default`` is what covers that
26
+ case: being a SQL expression it is rendered inline in the INSERT, so the value comes
27
+ from the database clock either way, and no DDL is required.
28
+
29
+ ``write_date`` is refreshed by ``onupdate``, which SQLAlchemy adds to the UPDATE
30
+ statement it builds: it therefore covers ``CrudRepository.update`` and ``upsert``, and
31
+ does **not** cover a raw SQL UPDATE run outside the library — that would need a
32
+ database trigger, which a mixin cannot install.
26
33
 
27
34
  Attributes:
28
35
  create_date (Column): Insert instant, from the ``now()`` of the database. Not null.
@@ -31,5 +38,5 @@ class TimestampMixin:
31
38
  update.
32
39
  """
33
40
 
34
- create_date = Column(DateTime, server_default=func.now(), nullable=False)
35
- write_date = Column(DateTime, server_default=func.now(), onupdate=func.now(), nullable=False)
41
+ create_date = Column(DateTime, default=func.now(), server_default=func.now(), nullable=False)
42
+ write_date = Column(DateTime, default=func.now(), server_default=func.now(), onupdate=func.now(), nullable=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-general-be-lib
3
- Version: 0.10.0
3
+ Version: 0.10.0.post2
4
4
  Summary: General purpose backend library — SQLAlchemy CRUD/Geometry repositories, FastAPI exceptions, Pydantic base models, logger utilities.
5
5
  Author-email: Andrea Di Placido <a.diplacido@arpes.it>, "Arpes S.r.l." <it.admin@arpes.it>
6
6
  License: MIT
@@ -17,7 +17,7 @@ general/interface/metadata/geom_metadata.py,sha256=gzeFkC9qyV_GXxtAaKmA9dka0DaC-
17
17
  general/interface/mixin/__init__.py,sha256=M5-e6T_R63Utwh3_WcmoE3wanwIZjNjbgLYrrFlSpTA,659
18
18
  general/interface/mixin/audit_mixin.py,sha256=N2JDD9JxXDMeBqu0yAlhVWFOK3EeUA2b215hPvXytUU,1421
19
19
  general/interface/mixin/softdelete_mixin.py,sha256=526luzM4DBCorcq99kZ6BYqtQKKJCpnxX9rSEigfyIU,2148
20
- general/interface/mixin/timestamp_mixin.py,sha256=TMetFs3zgI7YanckFnfycpNGn-ZbptwweKdOxe125O0,1641
20
+ general/interface/mixin/timestamp_mixin.py,sha256=wmcIx2Y8jgVqg9A-1E61BvkcKCo52ZjKNHeKfXJmUl0,2220
21
21
  general/interface/repository/__init__.py,sha256=eWoNy35LVu6sDrK5ju7VAeoclknKO0-yTgjVckJpi8s,321
22
22
  general/interface/repository/crud_repository.py,sha256=pA3zNvZuLa7Ddeq1j8vNjPNc4KFWAL1-RwEuyc5C0oE,40543
23
23
  general/interface/repository/geometry_repository.py,sha256=dB1AmZyyi5cWEzl-_4-2eOXXex-rQsa_cu6bl85wtNE,11252
@@ -33,8 +33,8 @@ general/interface/repository/handler/json_ilike_handler.py,sha256=icfA4dO8E_W_KU
33
33
  general/interface/repository/handler/or_handler.py,sha256=UOjIh77H4y-x434YGLYRfVIXKnod1M5XPiMf71V2JTg,3137
34
34
  general/interface/repository/handler/soft_delete_handler.py,sha256=1WD1n6q5plyJ0RDniJcEwNlic1WJqXvSlCj99VLc_3A,4100
35
35
  general/interface/repository/handler/statement_manager.py,sha256=dPG-HZy0jVM3Y4ZnCp2QPY4gLgt-rWSzOvY1_UmotcI,7333
36
- python_general_be_lib-0.10.0.dist-info/licenses/LICENSE,sha256=iUaO1XZyB9P3Tmog0OILuTisP6vXGe3QKz-4yRTxOFk,1069
37
- python_general_be_lib-0.10.0.dist-info/METADATA,sha256=yUNc1zJR-Nih7Iz9nVpD8jncus9MkL-fzihP8psvVfU,3410
38
- python_general_be_lib-0.10.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
39
- python_general_be_lib-0.10.0.dist-info/top_level.txt,sha256=tTZePW8_CNUqSgKFd2SEH72ZbnhS0OYjRsgcv0ikSFY,8
40
- python_general_be_lib-0.10.0.dist-info/RECORD,,
36
+ python_general_be_lib-0.10.0.post2.dist-info/licenses/LICENSE,sha256=iUaO1XZyB9P3Tmog0OILuTisP6vXGe3QKz-4yRTxOFk,1069
37
+ python_general_be_lib-0.10.0.post2.dist-info/METADATA,sha256=O8iGfUPSn-CZq-EUAL9SGfLW2TD1KL7DXmM_gXDPWO8,3416
38
+ python_general_be_lib-0.10.0.post2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
39
+ python_general_be_lib-0.10.0.post2.dist-info/top_level.txt,sha256=tTZePW8_CNUqSgKFd2SEH72ZbnhS0OYjRsgcv0ikSFY,8
40
+ python_general_be_lib-0.10.0.post2.dist-info/RECORD,,