diff --git a/dags/migrations/versions/64ac526a078b_my_db_revision.py b/dags/migrations/versions/64ac526a078b_my_db_revision.py index 1d0cab6..341a235 100644 --- a/dags/migrations/versions/64ac526a078b_my_db_revision.py +++ b/dags/migrations/versions/64ac526a078b_my_db_revision.py @@ -18,9 +18,8 @@ def upgrade(): - op.execute("CREATE SCHEMA IF NOT EXISTS oa") op.create_table( - "oa.open_access", + "oa_open_access", sa.Column("year", sa.Integer, primary_key=True), sa.Column("closed_access", sa.Integer, nullable=False), sa.Column("bronze_open_access", sa.Integer, nullable=False), @@ -28,11 +27,10 @@ def upgrade(): sa.Column("gold_open_access", sa.Integer, nullable=False), sa.Column("created_at", sa.TIMESTAMP(timezone=True), nullable=False), sa.Column("updated_at", sa.TIMESTAMP(timezone=True), nullable=False), - schema="oa", ) op.create_table( - "oa.golden_open_access", + "oa_golden_open_access", sa.Column("year", sa.Integer, primary_key=True), sa.Column("cern_read_and_publish", sa.Integer, nullable=False), sa.Column("cern_individual_apcs", sa.Integer, nullable=False), @@ -41,10 +39,9 @@ def upgrade(): sa.Column("other_collective_models", sa.Integer, nullable=False), sa.Column("created_at", sa.TIMESTAMP(timezone=True), nullable=False), sa.Column("updated_at", sa.TIMESTAMP(timezone=True), nullable=False), - schema="oa", ) def downgrade(): - op.drop_table("oa.golden_open_access", schema="oa") - op.drop_table("oa.open_access", schema="oa") + op.drop_table("oa_golden_open_access") + op.drop_table("oa_open_access") diff --git a/dags/open_access/gold_open_access_mechanisms.py b/dags/open_access/gold_open_access_mechanisms.py index ffd6c3b..3507a8e 100644 --- a/dags/open_access/gold_open_access_mechanisms.py +++ b/dags/open_access/gold_open_access_mechanisms.py @@ -48,8 +48,7 @@ def join(values, **kwargs): task_id="populate_golden_open_access", postgres_conn_id="superset_qa", sql=""" - SET search_path TO oa; - INSERT INTO "oa.golden_open_access" (year, cern_read_and_publish, cern_individual_apcs, + INSERT INTO oa_golden_open_access (year, cern_read_and_publish, cern_individual_apcs, scoap3, other, other_collective_models, created_at, updated_at) VALUES (%(years)s, %(cern_read_and_publish)s, %(cern_individual_apcs)s, %(scoap3)s, %(other)s, %(other_collective_models)s, diff --git a/dags/open_access/open_access.py b/dags/open_access/open_access.py index 72a617f..7ce12d3 100644 --- a/dags/open_access/open_access.py +++ b/dags/open_access/open_access.py @@ -48,8 +48,7 @@ def join(values, **kwargs): task_id="populate_open_access_table", postgres_conn_id="superset_qa", sql=""" - SET search_path TO oa; - INSERT INTO "oa.open_access" (year, closed_access, bronze_open_access, + INSERT INTO oa_open_access (year, closed_access, bronze_open_access, green_open_access, gold_open_access, created_at, updated_at) VALUES (%(years)s, %(closed)s, %(bronze)s, %(green)s, %(gold)s, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)