From 7f51f72eab45f996ab00fbfe26db6d52e811995c Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 8 Jan 2024 12:18:39 +0000 Subject: [PATCH] Allow current postgres config to run on GAE (#210) * Set file permissions for postgres container scripts * Use different schema name to db name It looks like on the GAE if you use a 'pixl' schema in a pixl database, then orthanc raw thinks the database is corrupted --- .pre-commit-config.yaml | 2 +- cli/tests/conftest.py | 2 +- docker/postgres/Dockerfile | 2 +- pixl_core/src/core/database.py | 2 +- postgres/create_pixl_tbls.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9bf49de07..035345532 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,4 +29,4 @@ repos: pass_filenames: false entry: mypy args: ['--config-file=setup.cfg'] - additional_dependencies: ['mypy', 'types-PyYAML', 'types-requests', 'types-python-slugify'] + additional_dependencies: ['mypy', 'types-PyYAML', 'types-requests', 'types-python-slugify', 'types-psycopg2'] diff --git a/cli/tests/conftest.py b/cli/tests/conftest.py index 0b760ee6d..0284448d4 100644 --- a/cli/tests/conftest.py +++ b/cli/tests/conftest.py @@ -60,7 +60,7 @@ def db_engine(monkeymodule) -> Engine: :returns Engine: Engine for use in other setup fixtures """ # SQLite doesnt support schemas, so remove pixl schema from engine options - execution_options = {"schema_translate_map": {"pixl": None}} + execution_options = {"schema_translate_map": {"pipeline": None}} engine = create_engine( "sqlite:///:memory:", execution_options=execution_options, diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile index 6ab7dde5a..721d19204 100644 --- a/docker/postgres/Dockerfile +++ b/docker/postgres/Dockerfile @@ -34,7 +34,7 @@ COPY --chmod=0755 ./postgres/postgres.conf /etc/postgresql/postgresql.conf COPY --chmod=0777 ./postgres/pixl-db_init.sh /docker-entrypoint-initdb.d/pixl-db_init.sh -COPY ./postgres/create_pixl_tbls.py /pixl/create_pixl_tbls.py +COPY --chmod=0777 ./postgres/create_pixl_tbls.py /pixl/create_pixl_tbls.py COPY ./pixl_core/ /pixl/pixl_core diff --git a/pixl_core/src/core/database.py b/pixl_core/src/core/database.py index a50976a89..6071076f4 100644 --- a/pixl_core/src/core/database.py +++ b/pixl_core/src/core/database.py @@ -24,7 +24,7 @@ class Base(DeclarativeBase): """sqlalchemy base class""" - metadata = MetaData(schema="pixl") + metadata = MetaData(schema="pipeline") class Extract(Base): diff --git a/postgres/create_pixl_tbls.py b/postgres/create_pixl_tbls.py index 01f5e5c69..142563e01 100644 --- a/postgres/create_pixl_tbls.py +++ b/postgres/create_pixl_tbls.py @@ -29,7 +29,7 @@ engine = create_engine(url, echo=True, echo_pool="debug") with engine.connect() as connection: - connection.execute(CreateSchema("pixl", if_not_exists=True)) + connection.execute(CreateSchema("pipeline", if_not_exists=True)) connection.commit() Base.metadata.create_all(engine)