Skip to content

Commit

Permalink
Allow current postgres config to run on GAE (#210)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stefpiatek authored Jan 8, 2024
1 parent 870d2e7 commit 7f51f72
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
2 changes: 1 addition & 1 deletion cli/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pixl_core/src/core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class Base(DeclarativeBase):
"""sqlalchemy base class"""

metadata = MetaData(schema="pixl")
metadata = MetaData(schema="pipeline")


class Extract(Base):
Expand Down
2 changes: 1 addition & 1 deletion postgres/create_pixl_tbls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 7f51f72

Please sign in to comment.