hdx-python-database 1.2.9__py3-none-any.whl → 1.3.0__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.
hdx/database/__init__.py CHANGED
@@ -23,7 +23,7 @@ class Database:
23
23
  reflected classes. db_has_tz which defaults to False indicates whether
24
24
  database datetime columns have timezones. If not, conversion occurs between
25
25
  Python datetimes with timezones to timezoneless database columns (but not
26
- when using reflection).
26
+ when using reflection). If table_base is supplied, db_has_tz is ignored.
27
27
 
28
28
  Args:
29
29
  database (Optional[str]): Database name
@@ -34,6 +34,7 @@ class Database:
34
34
  dialect (str): Database dialect. Defaults to "postgresql".
35
35
  driver (Optional[str]): Database driver. Defaults to None (psycopg if postgresql or None)
36
36
  db_has_tz (bool): True if db datetime columns have timezone. Defaults to False.
37
+ table_base (Optional[Type[DeclarativeBase]]): Override table base. Defaults to None.
37
38
  reflect (bool): Whether to reflect existing tables. Defaults to False.
38
39
  **kwargs: See below
39
40
  ssh_host (str): SSH host (the server to connect to)
@@ -55,6 +56,7 @@ class Database:
55
56
  dialect: str = "postgresql",
56
57
  driver: Optional[str] = None,
57
58
  db_has_tz: bool = False,
59
+ table_base: Optional[Type[DeclarativeBase]] = None,
58
60
  reflect: bool = False,
59
61
  **kwargs: Any,
60
62
  ) -> None:
@@ -98,10 +100,11 @@ class Database:
98
100
  )
99
101
  if dialect == "postgresql":
100
102
  wait_for_postgresql(db_uri)
101
- if db_has_tz:
102
- table_base = TZBase
103
- else:
104
- table_base = NoTZBase
103
+ if not table_base:
104
+ if db_has_tz:
105
+ table_base = TZBase
106
+ else:
107
+ table_base = NoTZBase
105
108
  self.session = self.get_session(
106
109
  db_uri, table_base=table_base, reflect=reflect
107
110
  )
hdx/database/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.2.9'
16
- __version_tuple__ = version_tuple = (1, 2, 9)
15
+ __version__ = version = '1.3.0'
16
+ __version_tuple__ = version_tuple = (1, 3, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hdx-python-database
3
- Version: 1.2.9
3
+ Version: 1.3.0
4
4
  Summary: HDX Python database utilities
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-database
6
6
  Author-email: Michael Rans <rans@email.com>
@@ -1,12 +1,12 @@
1
- hdx/database/__init__.py,sha256=2_cogxv3jcucC5bnhB6OP8MAB1Yw9Mi7HQnuQUyBtTk,5590
2
- hdx/database/_version.py,sha256=zd_kt_wsJmqzo58jY4byL9Q3ywofrUGUVUN0VUMtx8w,411
1
+ hdx/database/__init__.py,sha256=0CpgEC9GAqCtmZtBsTvwoDsW3T0VHY0aCNAh53piP6g,5835
2
+ hdx/database/_version.py,sha256=HGwtpza1HCPtlyqElUvIyH97K44TO13CYiYVZNezQ1M,411
3
3
  hdx/database/dburi.py,sha256=hNksrjaCC7AtD_M5ef0DCjkS0rJCofQqdXVD2BHBIGc,2938
4
4
  hdx/database/no_timezone.py,sha256=jawupasbCwNo-lDbX24CtxaSilb6LS-jLx-wZAa58nM,1129
5
5
  hdx/database/postgresql.py,sha256=9VlcdHhBURZPDaazj1kEq8gA4hUFJY-5hIN9uzibOlM,969
6
6
  hdx/database/utils.py,sha256=6lLymWriMFCq8BZgrDt4V5z14GR3PbvG_WXZeBc99Ws,415
7
7
  hdx/database/views.py,sha256=qJ_f6DpBUSzAGuBbgOXwQDZGni7b-DOUlAdAjSXKwhs,2635
8
8
  hdx/database/with_timezone.py,sha256=GUUylmTwQHp22yedmCVKpVJzvjWgdS9lg9KeqciNJkY,235
9
- hdx_python_database-1.2.9.dist-info/METADATA,sha256=qXigd1OavD8tVsIpo2KEUd-9twEfuADRHykvYFDesCc,2785
10
- hdx_python_database-1.2.9.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
11
- hdx_python_database-1.2.9.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
12
- hdx_python_database-1.2.9.dist-info/RECORD,,
9
+ hdx_python_database-1.3.0.dist-info/METADATA,sha256=8lJk615nDYiwB9vT9JUzfd-mpGVa6rIFA6kP9WVMgxI,2785
10
+ hdx_python_database-1.3.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
11
+ hdx_python_database-1.3.0.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
12
+ hdx_python_database-1.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.18.0
2
+ Generator: hatchling 1.21.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any