ecodev-core 0.0.46__py3-none-any.whl → 0.0.47__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.

Potentially problematic release.


This version of ecodev-core might be problematic. Click here for more details.

@@ -1,7 +1,9 @@
1
1
  """
2
2
  Module handling CRUD and version operations
3
3
  """
4
+ from datetime import datetime
4
5
  from functools import partial
6
+ from typing import Any
5
7
  from typing import Union
6
8
 
7
9
  import pandas as pd
@@ -78,12 +80,20 @@ def upsert_updator(values: SQLModel,
78
80
  col_types = {x: y.annotation for x, y in db_schema.__fields__.items()}
79
81
  table = db_schema.__tablename__
80
82
 
81
- for col, val in {k: v for k, v in db.items() if k in to_update and v != to_update[k]}.items():
83
+ for col, val in {k: v for k, v in db.items() if k in to_update and _value_comparator(
84
+ v, to_update[k])}.items():
82
85
  session.add(Version.from_table_row(table, col, row_id, col_types[col], val))
83
86
 
84
87
  return update(db_schema).where(db_schema.id == row_id).values(**to_update)
85
88
 
86
89
 
90
+ def _value_comparator(v: Any, to_update: Any) -> bool:
91
+ """
92
+ Performs a comparison between the value in db and the value to be upserted
93
+ """
94
+ return v.date() != to_update.date() if isinstance(v, datetime) else v != to_update
95
+
96
+
87
97
  def upsert_deletor(values: SQLModel, session: Session):
88
98
  """
89
99
  Delete row in db corresponding to the passed values, selecting on columns not to be versioned.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-core
3
- Version: 0.0.46
3
+ Version: 0.0.47
4
4
  Summary: Low level sqlmodel/fastapi/pydantic building blocks
5
5
  License: MIT
6
6
  Author: Thomas Epelbaum
@@ -11,7 +11,7 @@ ecodev_core/db_connection.py,sha256=bc5MujZ57f204wTsuNVdn1JdP-zBzkDJxHmdxBDTiNs,
11
11
  ecodev_core/db_filters.py,sha256=T_5JVF27UEu7sC6NOm7-W3_Y0GLfbWQO_EeTXcD2cv8,5041
12
12
  ecodev_core/db_insertion.py,sha256=RSCyAlUObbBlWJuMRX-YFY4VgtWqYLdwRqMWw--x95Y,3646
13
13
  ecodev_core/db_retrieval.py,sha256=IxyF3ZtKgACLiNFggK7boKggvMRKYDRD2IimxU4dap4,7345
14
- ecodev_core/db_upsertion.py,sha256=W7_TEMZh97FUQ9nJnOXAiwH1u5KLmF8pinjjM6NUaDc,4602
14
+ ecodev_core/db_upsertion.py,sha256=xL70gr3_NTpMDSGnakzE3mm_i3xm-dfgbD9zYCYjc64,4924
15
15
  ecodev_core/deployment.py,sha256=z8ACI00EtKknXOB8xyPwYIXTvPjIDOH9z9cBGEU0YrA,281
16
16
  ecodev_core/email_sender.py,sha256=XD7jAVXhGzvbiHqMhK9_aTEIS70Lw_CmPeAxRZGji-Y,1610
17
17
  ecodev_core/enum_utils.py,sha256=BkQ4YQ97tXBYmMcQiSIi0mbioD5CgVU79myg1BBAXuA,556
@@ -26,7 +26,7 @@ ecodev_core/safe_utils.py,sha256=Q8N15El1tSxZJJsy1i_1CCycuBN1_98QQoHmYJRcLIY,690
26
26
  ecodev_core/settings.py,sha256=ARAPkXxggVUsYqSQIAgCK8C2DKSMPia1CekULn428bA,1562
27
27
  ecodev_core/sqlmodel_utils.py,sha256=t57H3QPtKRy4ujic1clMK_2L4p0yjGJLZbDjHPZ8M94,453
28
28
  ecodev_core/version.py,sha256=5lQ5Nzi38ziFzHICoRoGyLzidgFcUCnLdxlpK6s8Y0U,4423
29
- ecodev_core-0.0.46.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
30
- ecodev_core-0.0.46.dist-info/METADATA,sha256=DAo4XMyD0emMg2xvp-QBWdc5-ZvcwmwZjoANZVvK5dI,3509
31
- ecodev_core-0.0.46.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- ecodev_core-0.0.46.dist-info/RECORD,,
29
+ ecodev_core-0.0.47.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
30
+ ecodev_core-0.0.47.dist-info/METADATA,sha256=gOrrSLWi0Erw6ogpoMZk383IurextcU1hbic6wFdcho,3509
31
+ ecodev_core-0.0.47.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ ecodev_core-0.0.47.dist-info/RECORD,,