hdx-python-database 1.3.4__tar.gz → 1.3.5__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.4 → hdx_python_database-1.3.5}/.config/pre-commit-config.yaml +3 -3
  2. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/PKG-INFO +2 -2
  3. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/pyproject.toml +3 -0
  4. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/requirements.txt +14 -14
  5. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/_version.py +2 -2
  6. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/views.py +8 -17
  7. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.config/coveragerc +0 -0
  8. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.config/pytest.ini +0 -0
  9. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.config/ruff.toml +0 -0
  10. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.github/workflows/publish.yaml +0 -0
  11. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.github/workflows/run-python-tests.yaml +0 -0
  12. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/.gitignore +0 -0
  13. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/CONTRIBUTING.md +0 -0
  14. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/LICENSE +0 -0
  15. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/README.md +0 -0
  16. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/documentation/.readthedocs.yaml +0 -0
  17. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/documentation/main.md +0 -0
  18. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/documentation/pydoc-markdown.yaml +0 -0
  19. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/__init__.py +0 -0
  20. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/dburi.py +0 -0
  21. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/no_timezone.py +0 -0
  22. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/postgresql.py +0 -0
  23. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/utils.py +0 -0
  24. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/src/hdx/database/with_timezone.py +0 -0
  25. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/fixtures/test.db +0 -0
  26. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/__init__.py +0 -0
  27. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/conftest.py +0 -0
  28. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/dbtestdate.py +0 -0
  29. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_database.py +0 -0
  30. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_dburi.py +0 -0
  31. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_postgresql.py +0 -0
  32. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_recreate.py +0 -0
  33. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_reflect.py +0 -0
  34. {hdx_python_database-1.3.4 → hdx_python_database-1.3.5}/tests/hdx/database/test_ssh.py +0 -0
@@ -2,13 +2,13 @@ default_language_version:
2
2
  python: python3.12
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.6.0
5
+ rev: v5.0.0
6
6
  hooks:
7
7
  - id: trailing-whitespace
8
8
  - id: end-of-file-fixer
9
9
  - id: check-ast
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.6.9
11
+ rev: v0.9.6
12
12
  hooks:
13
13
  # Run the linter.
14
14
  - id: ruff
@@ -17,7 +17,7 @@ repos:
17
17
  - id: ruff-format
18
18
  args: [--config, .config/ruff.toml]
19
19
  - repo: https://github.com/astral-sh/uv-pre-commit
20
- rev: 0.4.18
20
+ rev: 0.5.29
21
21
  hooks:
22
22
  # Run the pip compile
23
23
  - id: pip-compile
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: hdx-python-database
3
- Version: 1.3.4
3
+ Version: 1.3.5
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>
@@ -88,6 +88,9 @@ run = """
88
88
  --cov-report=lcov --cov-report=term-missing
89
89
  """
90
90
 
91
+ [tool.hatch.envs.hatch-static-analysis]
92
+ dependencies = ["ruff==0.9.6"]
93
+
91
94
  [tool.hatch.envs.hatch-static-analysis.scripts]
92
95
  format-check = ["ruff format --config .config/ruff.toml --check --diff {args:.}",]
93
96
  format-fix = ["ruff format --config .config/ruff.toml {args:.}",]
@@ -1,6 +1,6 @@
1
1
  # This file was autogenerated by uv via the following command:
2
2
  # uv pip compile pyproject.toml --resolver=backtracking --all-extras -o requirements.txt
3
- bcrypt==4.2.0
3
+ bcrypt==4.2.1
4
4
  # via paramiko
5
5
  cffi==1.17.1
6
6
  # via
@@ -8,49 +8,49 @@ cffi==1.17.1
8
8
  # pynacl
9
9
  cfgv==3.4.0
10
10
  # via pre-commit
11
- coverage==7.6.3
11
+ coverage==7.6.11
12
12
  # via pytest-cov
13
- cryptography==43.0.1
13
+ cryptography==44.0.0
14
14
  # via paramiko
15
15
  distlib==0.3.9
16
16
  # via virtualenv
17
- filelock==3.16.1
17
+ filelock==3.17.0
18
18
  # via virtualenv
19
19
  greenlet==3.1.1
20
20
  # via sqlalchemy
21
- identify==2.6.1
21
+ identify==2.6.7
22
22
  # via pre-commit
23
23
  iniconfig==2.0.0
24
24
  # via pytest
25
25
  nodeenv==1.9.1
26
26
  # via pre-commit
27
- packaging==24.1
27
+ packaging==24.2
28
28
  # via pytest
29
- paramiko==3.5.0
29
+ paramiko==3.5.1
30
30
  # via sshtunnel
31
31
  platformdirs==4.3.6
32
32
  # via virtualenv
33
33
  pluggy==1.5.0
34
34
  # via pytest
35
- pre-commit==4.0.1
35
+ pre-commit==4.1.0
36
36
  # via hdx-python-database (pyproject.toml)
37
- psycopg==3.2.3
37
+ psycopg==3.2.4
38
38
  # via hdx-python-database (pyproject.toml)
39
- psycopg-binary==3.2.3
39
+ psycopg-binary==3.2.4
40
40
  # via psycopg
41
41
  pycparser==2.22
42
42
  # via cffi
43
43
  pynacl==1.5.0
44
44
  # via paramiko
45
- pytest==8.3.3
45
+ pytest==8.3.4
46
46
  # via
47
47
  # hdx-python-database (pyproject.toml)
48
48
  # pytest-cov
49
- pytest-cov==5.0.0
49
+ pytest-cov==6.0.0
50
50
  # via hdx-python-database (pyproject.toml)
51
51
  pyyaml==6.0.2
52
52
  # via pre-commit
53
- sqlalchemy==2.0.35
53
+ sqlalchemy==2.0.38
54
54
  # via hdx-python-database (pyproject.toml)
55
55
  sshtunnel==0.4.0
56
56
  # via hdx-python-database (pyproject.toml)
@@ -58,5 +58,5 @@ typing-extensions==4.12.2
58
58
  # via
59
59
  # psycopg
60
60
  # sqlalchemy
61
- virtualenv==20.26.6
61
+ virtualenv==20.29.1
62
62
  # via pre-commit
@@ -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.4'
16
- __version_tuple__ = version_tuple = (1, 3, 4)
15
+ __version__ = version = '1.3.5'
16
+ __version_tuple__ = version_tuple = (1, 3, 5)
@@ -7,10 +7,8 @@ https://github.com/sqlalchemy/sqlalchemy/wiki/Views#sqlalchemy-14-20-version
7
7
  """
8
8
 
9
9
  import sqlalchemy as sa
10
- from sqlalchemy import MetaData, Selectable, TableClause
11
10
  from sqlalchemy.ext import compiler
12
11
  from sqlalchemy.schema import DDLElement
13
- from sqlalchemy.sql import table
14
12
 
15
13
 
16
14
  class CreateView(DDLElement):
@@ -45,22 +43,15 @@ def view_doesnt_exist(ddl, target, connection, **kw):
45
43
  return not view_exists(ddl, target, connection, **kw)
46
44
 
47
45
 
48
- def view(name: str, metadata: MetaData, selectable: Selectable) -> TableClause:
49
- """Prepare SQLAlchemy view. Must be run before Base.metadata.create_all.
50
-
51
- Args:
52
- name (str): View name
53
- metadata (MetaData): Base metadata
54
- selectable (Selectable): SQLAlchemy select statement
55
-
56
- Returns:
57
- TableClause: SQLAlchemy View
58
- """
59
- t = table(name)
60
-
61
- t._columns._populate_separate_keys(
62
- col._make_proxy(t) for col in selectable.selected_columns
46
+ def view(name, metadata, selectable):
47
+ t = sa.table(
48
+ name,
49
+ *(
50
+ sa.Column(c.name, c.type, primary_key=c.primary_key)
51
+ for c in selectable.selected_columns
52
+ ),
63
53
  )
54
+ t.primary_key.update(c for c in t.c if c.primary_key)
64
55
 
65
56
  sa.event.listen(
66
57
  metadata,