Skip to content

Commit

Permalink
remove ppe to ferc1 assn fk (#3819)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgosnell authored Aug 27, 2024
1 parent 62ddca1 commit 87c2634
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Remove FK relationship for record_id_eia
Revision ID: 57f2bda37a11
Revises: a47a74d21b3f
Create Date: 2024-08-27 15:15:07.631921
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '57f2bda37a11'
down_revision = 'a47a74d21b3f'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op:
batch_op.drop_constraint('fk_out_pudl__yearly_assn_eia_ferc1_plant_parts_record_id_eia_out_eia__yearly_plant_parts', type_='foreignkey')

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op:
batch_op.create_foreign_key('fk_out_pudl__yearly_assn_eia_ferc1_plant_parts_record_id_eia_out_eia__yearly_plant_parts', 'out_eia__yearly_plant_parts', ['record_id_eia'], ['record_id_eia'])

# ### end Alembic commands ###
4 changes: 3 additions & 1 deletion src/pudl/metadata/resources/ferc1_eia_record_linkage.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@
],
"primary_key": ["record_id_eia"],
"foreign_key_rules": {
"fields": [["record_id_eia"], ["record_id_eia_plant_gen"]]
"fields": [["record_id_eia"], ["record_id_eia_plant_gen"]],
# TODO: track down 10 missing record_id_eia's in this table #3818
"exclude": ["out_pudl__yearly_assn_eia_ferc1_plant_parts"],
},
},
"sources": ["eia860", "eia923"],
Expand Down

0 comments on commit 87c2634

Please sign in to comment.