hdx-python-database 1.3.2__py3-none-any.whl → 1.3.4__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 +14 -3
- hdx/database/_version.py +2 -2
- hdx/database/postgresql.py +1 -1
- {hdx_python_database-1.3.2.dist-info → hdx_python_database-1.3.4.dist-info}/METADATA +1 -1
- hdx_python_database-1.3.4.dist-info/RECORD +12 -0
- hdx_python_database-1.3.2.dist-info/RECORD +0 -12
- {hdx_python_database-1.3.2.dist-info → hdx_python_database-1.3.4.dist-info}/WHEEL +0 -0
- {hdx_python_database-1.3.2.dist-info → hdx_python_database-1.3.4.dist-info}/licenses/LICENSE +0 -0
hdx/database/__init__.py
CHANGED
|
@@ -173,7 +173,11 @@ class Database:
|
|
|
173
173
|
self.reflected_classes = None
|
|
174
174
|
|
|
175
175
|
def cleanup(self) -> None:
|
|
176
|
-
|
|
176
|
+
"""Cleanup SQLAlchemy.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
sqlalchemy.Engine: SQLAlchemy engine
|
|
180
|
+
"""
|
|
177
181
|
self.session.close()
|
|
178
182
|
self.engine.dispose()
|
|
179
183
|
if self.server is not None:
|
|
@@ -185,7 +189,12 @@ class Database:
|
|
|
185
189
|
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
|
186
190
|
self.cleanup()
|
|
187
191
|
|
|
188
|
-
def drop_all(self):
|
|
192
|
+
def drop_all(self) -> None:
|
|
193
|
+
"""Drop all tables.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
None
|
|
197
|
+
"""
|
|
189
198
|
self.base.metadata.drop_all(self.engine)
|
|
190
199
|
|
|
191
200
|
def get_engine(self) -> Engine:
|
|
@@ -249,7 +258,9 @@ class Database:
|
|
|
249
258
|
engine = create_engine(db_uri, poolclass=NullPool, echo=False)
|
|
250
259
|
if reflect:
|
|
251
260
|
Base = automap_base(declarative_base=table_base)
|
|
252
|
-
Base.prepare(
|
|
261
|
+
Base.prepare(
|
|
262
|
+
autoload_with=engine, reflection_options={"views": True}
|
|
263
|
+
)
|
|
253
264
|
table_base = Base
|
|
254
265
|
else:
|
|
255
266
|
table_base.metadata.create_all(engine)
|
hdx/database/_version.py
CHANGED
hdx/database/postgresql.py
CHANGED
|
@@ -87,7 +87,7 @@ def restore_from_pgfile(db_uri: str, pg_restore_file: str) -> str:
|
|
|
87
87
|
except subprocess.CalledProcessError as ex:
|
|
88
88
|
command = " ".join(subprocess_params)
|
|
89
89
|
raise PostgresError(
|
|
90
|
-
f"{command} failed. Return code: {process.returncode}"
|
|
90
|
+
f"{command} failed. Return code: {process.returncode}. Error: {process.stderr}"
|
|
91
91
|
) from ex
|
|
92
92
|
|
|
93
93
|
for line in process.stdout.splitlines():
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
hdx/database/__init__.py,sha256=KS5VOdLv9P-YDTE_2ZUtVm6QNwezNpXMSd7SvMYU4EM,11655
|
|
2
|
+
hdx/database/_version.py,sha256=q-rMkBhc2cbe8SdkcXn0kh8Fvtl2cIlapH0EvPC1bmc,411
|
|
3
|
+
hdx/database/dburi.py,sha256=rw8RuLpU85vxYl5-Zk1SdZRAz-tqre_ot5aEnkjhxAQ,2977
|
|
4
|
+
hdx/database/no_timezone.py,sha256=Lw087G3qOf8H70o8Hq_VvOMZ3ANei-lIA_sUlpFU_Uo,1130
|
|
5
|
+
hdx/database/postgresql.py,sha256=i5s_CJQZagMTuzgmnLakCOnSnvczpgJ26Q1CV6lz2_A,2646
|
|
6
|
+
hdx/database/utils.py,sha256=6lLymWriMFCq8BZgrDt4V5z14GR3PbvG_WXZeBc99Ws,415
|
|
7
|
+
hdx/database/views.py,sha256=R_1Ni0U2CL3IlydxcB1vyZp7QoDZim6g-807jQIaWQU,1950
|
|
8
|
+
hdx/database/with_timezone.py,sha256=GUUylmTwQHp22yedmCVKpVJzvjWgdS9lg9KeqciNJkY,235
|
|
9
|
+
hdx_python_database-1.3.4.dist-info/METADATA,sha256=HjOmHAG50Rstq_1SbBcfg7rtjoPG64L2VHFRWZwYsMU,2691
|
|
10
|
+
hdx_python_database-1.3.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
11
|
+
hdx_python_database-1.3.4.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
|
|
12
|
+
hdx_python_database-1.3.4.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
hdx/database/__init__.py,sha256=cOAnY4cOLcjxM556jAIfw9XqTIKk7mSwZCugIf3XpPA,11431
|
|
2
|
-
hdx/database/_version.py,sha256=ik9WUFYTvRcmzFEUSqkI2H_62uw0XFdUT3mTLq8-_RY,411
|
|
3
|
-
hdx/database/dburi.py,sha256=rw8RuLpU85vxYl5-Zk1SdZRAz-tqre_ot5aEnkjhxAQ,2977
|
|
4
|
-
hdx/database/no_timezone.py,sha256=Lw087G3qOf8H70o8Hq_VvOMZ3ANei-lIA_sUlpFU_Uo,1130
|
|
5
|
-
hdx/database/postgresql.py,sha256=BrEuRnuR2dt3HwJ-o_IzGFs8eT3iXKzDqMSNKPyQ18Y,2621
|
|
6
|
-
hdx/database/utils.py,sha256=6lLymWriMFCq8BZgrDt4V5z14GR3PbvG_WXZeBc99Ws,415
|
|
7
|
-
hdx/database/views.py,sha256=R_1Ni0U2CL3IlydxcB1vyZp7QoDZim6g-807jQIaWQU,1950
|
|
8
|
-
hdx/database/with_timezone.py,sha256=GUUylmTwQHp22yedmCVKpVJzvjWgdS9lg9KeqciNJkY,235
|
|
9
|
-
hdx_python_database-1.3.2.dist-info/METADATA,sha256=ZCPvpjSSs0PxElgVksIa2v7wBo2soTX52wfl4d9eau4,2691
|
|
10
|
-
hdx_python_database-1.3.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
11
|
-
hdx_python_database-1.3.2.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
|
|
12
|
-
hdx_python_database-1.3.2.dist-info/RECORD,,
|
|
File without changes
|
{hdx_python_database-1.3.2.dist-info → hdx_python_database-1.3.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|