hdx-python-database 1.3.2__tar.gz → 1.3.3__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.
Files changed (34) hide show
  1. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/PKG-INFO +1 -1
  2. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/__init__.py +11 -2
  3. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/_version.py +2 -2
  4. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_database.py +0 -1
  5. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_reflect.py +0 -1
  6. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_ssh.py +0 -16
  7. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.config/coveragerc +0 -0
  8. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.config/pre-commit-config.yaml +0 -0
  9. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.config/pytest.ini +0 -0
  10. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.config/ruff.toml +0 -0
  11. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.github/workflows/publish.yaml +0 -0
  12. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.github/workflows/run-python-tests.yaml +0 -0
  13. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/.gitignore +0 -0
  14. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/CONTRIBUTING.md +0 -0
  15. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/LICENSE +0 -0
  16. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/README.md +0 -0
  17. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/documentation/.readthedocs.yaml +0 -0
  18. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/documentation/main.md +0 -0
  19. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/documentation/pydoc-markdown.yaml +0 -0
  20. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/pyproject.toml +0 -0
  21. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/requirements.txt +0 -0
  22. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/dburi.py +0 -0
  23. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/no_timezone.py +0 -0
  24. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/postgresql.py +0 -0
  25. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/utils.py +0 -0
  26. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/views.py +0 -0
  27. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/src/hdx/database/with_timezone.py +0 -0
  28. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/fixtures/test.db +0 -0
  29. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/__init__.py +0 -0
  30. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/conftest.py +0 -0
  31. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/dbtestdate.py +0 -0
  32. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_dburi.py +0 -0
  33. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_postgresql.py +0 -0
  34. {hdx_python_database-1.3.2 → hdx_python_database-1.3.3}/tests/hdx/database/test_recreate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hdx-python-database
3
- Version: 1.3.2
3
+ Version: 1.3.3
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>
@@ -173,7 +173,11 @@ class Database:
173
173
  self.reflected_classes = None
174
174
 
175
175
  def cleanup(self) -> None:
176
- self.base.metadata.clear()
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:
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.3.2'
16
- __version_tuple__ = version_tuple = (1, 3, 2)
15
+ __version__ = version = '1.3.3'
16
+ __version_tuple__ = version_tuple = (1, 3, 3)
@@ -48,7 +48,6 @@ class TestDatabase:
48
48
  date_view = dbdatabase.get_prepare_results()[0]
49
49
  dbtestdate = dbsession.execute(select(date_view)).scalar_one()
50
50
  assert dbtestdate == now
51
- dbdatabase.drop_all()
52
51
 
53
52
  def test_errors(self):
54
53
  with pytest.raises(DatabaseError):
@@ -44,4 +44,3 @@ class TestReflect:
44
44
  # with reflection, type annotation maps do not work and hence
45
45
  # we don't have a timezone here
46
46
  assert row.date1 == datetime(1993, 9, 23, 14, 12, 56, 111000)
47
- dbdatabase.drop_all()
@@ -34,10 +34,6 @@ class TestSSH:
34
34
  == "postgresql+psycopg://myuser@0.0.0.0:12345/mydatabase"
35
35
  )
36
36
  assert dbdatabase.base == TZBase
37
- try:
38
- dbdatabase.drop_all()
39
- except AttributeError:
40
- pass
41
37
 
42
38
  with Database(
43
39
  ssh_host="mysshhost", ssh_port=25, table_base=TZBase, **params
@@ -48,10 +44,6 @@ class TestSSH:
48
44
  == "postgresql+psycopg://myuser@0.0.0.0:12345/mydatabase"
49
45
  )
50
46
  assert dbdatabase.base == TZBase
51
- try:
52
- dbdatabase.drop_all()
53
- except AttributeError:
54
- pass
55
47
 
56
48
  with Database(ssh_host="mysshhost", **self.params_pg) as dbdatabase:
57
49
  dbsession = dbdatabase.get_session()
@@ -60,10 +52,6 @@ class TestSSH:
60
52
  == "postgresql+psycopg://myuser:***@0.0.0.0:12345/mydatabase"
61
53
  )
62
54
  assert dbdatabase.base == NoTZBase
63
- try:
64
- dbdatabase.drop_all()
65
- except AttributeError:
66
- pass
67
55
 
68
56
  with Database(
69
57
  ssh_host="mysshhost", ssh_port=25, **params
@@ -74,7 +62,3 @@ class TestSSH:
74
62
  == "postgresql+psycopg://myuser@0.0.0.0:12345/mydatabase"
75
63
  )
76
64
  assert dbdatabase.base == NoTZBase
77
- try:
78
- dbdatabase.drop_all()
79
- except AttributeError:
80
- pass