-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2936 from catalyst-cooperative/add-data-maturity-…
…for-923m Add monthly data and data maturity for 923m
- Loading branch information
Showing
29 changed files
with
561 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
migrations/versions/1ceb9897fd34_add_data_maturity_to_eia923m_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
"""add data_maturity to eia923m tables | ||
Revision ID: 1ceb9897fd34 | ||
Revises: f11241c9292d | ||
Create Date: 2023-10-26 16:30:33.771381 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '1ceb9897fd34' | ||
down_revision = 'f11241c9292d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_boiler_fuel_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_boiler_fuel_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_boiler_fuel_monthly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_yearly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_boiler_fuel_yearly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_fuel_receipts_costs_monthly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_fuel_receipts_costs_yearly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_fuel_receipts_costs_yearly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_fuel_combined_monthly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_generation_fuel_combined_yearly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_fuel_combined_yearly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_monthly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_generation_yearly_eia923', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_yearly_eia923_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
with op.batch_alter_table('denorm_plants_utilities_eia', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('data_maturity', sa.Text(), nullable=True, comment='Level of maturity of the data record. Some data sources report less-than-final data. PUDL sometimes includes this data, but use at your own risk.')) | ||
batch_op.create_foreign_key(batch_op.f('fk_denorm_plants_utilities_eia_data_maturity_data_maturities'), 'data_maturities', ['data_maturity'], ['code']) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('denorm_plants_utilities_eia', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_plants_utilities_eia_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_generation_yearly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_yearly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_monthly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_generation_fuel_combined_yearly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_fuel_combined_yearly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_fuel_combined_monthly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_fuel_receipts_costs_yearly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_fuel_receipts_costs_yearly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_fuel_receipts_costs_monthly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_yearly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_boiler_fuel_yearly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_boiler_fuel_monthly_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_denorm_boiler_fuel_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op: | ||
batch_op.drop_constraint(batch_op.f('fk_boiler_fuel_eia923_data_maturity_data_maturities'), type_='foreignkey') | ||
batch_op.drop_column('data_maturity') | ||
|
||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.