Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer
- id: check-ast
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.9
hooks:
# Run the linter.
- id: ruff
Expand All @@ -17,7 +17,7 @@ repos:
- id: ruff-format
args: [--config, .config/ruff.toml]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.2.33
rev: 0.4.18
hooks:
# Run the pip compile
- id: pip-compile
Expand Down
30 changes: 15 additions & 15 deletions requirements.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@
# uv pip compile pyproject.toml --resolver=backtracking --all-extras -o requirements.txt
bcrypt==4.2.0
# via paramiko
cffi==1.17.0
cffi==1.17.1
# via
# cryptography
# pynacl
cfgv==3.4.0
# via pre-commit
coverage==7.6.1
coverage==7.6.3
# via pytest-cov
cryptography==43.0.0
cryptography==43.0.1
# via paramiko
distlib==0.3.8
distlib==0.3.9
# via virtualenv
filelock==3.15.4
filelock==3.16.1
# via virtualenv
greenlet==3.0.3
greenlet==3.1.1
# via sqlalchemy
identify==2.6.0
identify==2.6.1
# via pre-commit
iniconfig==2.0.0
# via pytest
nodeenv==1.9.1
# via pre-commit
packaging==24.1
# via pytest
paramiko==3.4.1
paramiko==3.5.0
# via sshtunnel
platformdirs==4.2.2
platformdirs==4.3.6
# via virtualenv
pluggy==1.5.0
# via pytest
pre-commit==3.8.0
pre-commit==4.0.1
# via hdx-python-database (pyproject.toml)
psycopg==3.2.1
psycopg==3.2.3
# via hdx-python-database (pyproject.toml)
psycopg-binary==3.2.1
psycopg-binary==3.2.3
# via psycopg
pycparser==2.22
# via cffi
pynacl==1.5.0
# via paramiko
pytest==8.3.2
pytest==8.3.3
# via
# hdx-python-database (pyproject.toml)
# pytest-cov
pytest-cov==5.0.0
# via hdx-python-database (pyproject.toml)
pyyaml==6.0.2
# via pre-commit
sqlalchemy==2.0.32
sqlalchemy==2.0.35
# via hdx-python-database (pyproject.toml)
sshtunnel==0.4.0
# via hdx-python-database (pyproject.toml)
typing-extensions==4.12.2
# via
# psycopg
# sqlalchemy
virtualenv==20.26.3
virtualenv==20.26.6
# via pre-commit
4 changes: 3 additions & 1 deletion src/hdx/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ def create_session(
engine = create_engine(db_uri, poolclass=NullPool, echo=False)
if reflect:
Base = automap_base(declarative_base=table_base)
Base.prepare(autoload_with=engine)
Base.prepare(
autoload_with=engine, reflection_options={"views": True}
)
table_base = Base
else:
table_base.metadata.create_all(engine)
Expand Down
2 changes: 1 addition & 1 deletion src/hdx/database/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def restore_from_pgfile(db_uri: str, pg_restore_file: str) -> str:
except subprocess.CalledProcessError as ex:
command = " ".join(subprocess_params)
raise PostgresError(
f"{command} failed. Return code: {process.returncode}"
f"{command} failed. Return code: {process.returncode}. Error: {process.stderr}"
) from ex

for line in process.stdout.splitlines():
Expand Down
4 changes: 3 additions & 1 deletion tests/hdx/database/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from datetime import datetime, timezone
from os import remove
from os.path import join
from os.path import exists, join
from tempfile import gettempdir

import pytest
Expand All @@ -21,6 +21,8 @@ def prepare_fn():
return Database.prepare_views([date_view_params])

dbpath = join(gettempdir(), "test_database.db")
if exists(dbpath):
remove(dbpath)
with Database(
database=dbpath,
port=None,
Expand Down