Skip to content

Commit

Permalink
Add FK exclusion for eia plants table (#3491)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-belfer authored Mar 20, 2024
1 parent 69edbc5 commit 91d39d3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Exclude 923 FGD table from 860 FK
Revision ID: 41120381bfda
Revises: b8ae440a2d32
Create Date: 2024-03-20 15:02:11.634526
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '41120381bfda'
down_revision = 'b8ae440a2d32'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('_core_eia923__fgd_operation_maintenance', schema=None) as batch_op:
batch_op.drop_constraint('fk__core_eia923__fgd_operation_maintenance_plant_id_eia_core_eia860__scd_plants', type_='foreignkey')
batch_op.create_foreign_key(batch_op.f('fk__core_eia923__fgd_operation_maintenance_plant_id_eia_core_eia__entity_plants'), 'core_eia__entity_plants', ['plant_id_eia'], ['plant_id_eia'])

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('_core_eia923__fgd_operation_maintenance', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk__core_eia923__fgd_operation_maintenance_plant_id_eia_core_eia__entity_plants'), type_='foreignkey')
batch_op.create_foreign_key('fk__core_eia923__fgd_operation_maintenance_plant_id_eia_core_eia860__scd_plants', 'core_eia860__scd_plants', ['plant_id_eia', 'report_date'], ['plant_id_eia', 'report_date'])

# ### end Alembic commands ###
1 change: 1 addition & 0 deletions src/pudl/metadata/resources/eia860.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
# See: https://github.com/catalyst-cooperative/pudl/issues/1196
"exclude": [
"_core_eia923__cooling_system_information",
"_core_eia923__fgd_operation_maintenance",
"core_eia923__monthly_boiler_fuel",
"out_eia923__boiler_fuel",
"out_eia923__monthly_boiler_fuel",
Expand Down

0 comments on commit 91d39d3

Please sign in to comment.