-
-
Notifications
You must be signed in to change notification settings - Fork 119
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 #3029 from catalyst-cooperative/rename-heat-rate-m…
…mbtu-mwh-column Rename `heat_rate_mmbtu_mwh -> unit_heat_rate_mmbtu_per_mwh`... again
- Loading branch information
Showing
11 changed files
with
348 additions
and
40 deletions.
There are no files selected for viewing
305 changes: 305 additions & 0 deletions
305
migrations/versions/ccdf68a30cbd_add_unit__to_heat_rate_mmbtu_per_mwh.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,305 @@ | ||
"""Add unit_ to heat_rate_mmbtu_per_mwh | ||
Revision ID: ccdf68a30cbd | ||
Revises: 9edc4a11c809 | ||
Create Date: 2023-11-15 14:09:59.541894 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "ccdf68a30cbd" | ||
down_revision = "9edc4a11c809" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table( | ||
"_out_eia__monthly_derived_generator_attributes", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_fuel_cost_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_heat_rate_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_heat_rate_by_unit", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_derived_generator_attributes", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_fuel_cost_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_heat_rate_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_heat_rate_by_unit", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table("mega_generators_eia", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table("out_eia__monthly_generators", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table("out_eia__yearly_generators", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"out_eia__yearly_generators_by_ownership", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table("out_eia__yearly_plant_parts", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
with op.batch_alter_table( | ||
"out_pudl__yearly_assn_eia_ferc1_plant_parts", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh_eia", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh_ferc1", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Calculated from FERC reported fuel consumption and net generation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh_eia") | ||
batch_op.drop_column("heat_rate_mmbtu_mwh_ferc1") | ||
|
||
with op.batch_alter_table("plant_parts_eia", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"unit_heat_rate_mmbtu_per_mwh", | ||
sa.Float(), | ||
nullable=True, | ||
comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", | ||
) | ||
) | ||
batch_op.drop_column("heat_rate_mmbtu_mwh") | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("plant_parts_eia", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"out_pudl__yearly_assn_eia_ferc1_plant_parts", schema=None | ||
) as batch_op: | ||
batch_op.add_column( | ||
sa.Column("heat_rate_mmbtu_mwh_ferc1", sa.FLOAT(), nullable=True) | ||
) | ||
batch_op.add_column( | ||
sa.Column("heat_rate_mmbtu_mwh_eia", sa.FLOAT(), nullable=True) | ||
) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh_ferc1") | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh_eia") | ||
|
||
with op.batch_alter_table("out_eia__yearly_plant_parts", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"out_eia__yearly_generators_by_ownership", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table("out_eia__yearly_generators", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table("out_eia__monthly_generators", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table("mega_generators_eia", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_heat_rate_by_unit", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_heat_rate_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_fuel_cost_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__yearly_derived_generator_attributes", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_heat_rate_by_unit", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_heat_rate_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_fuel_cost_by_generator", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
with op.batch_alter_table( | ||
"_out_eia__monthly_derived_generator_attributes", schema=None | ||
) as batch_op: | ||
batch_op.add_column(sa.Column("heat_rate_mmbtu_mwh", sa.FLOAT(), nullable=True)) | ||
batch_op.drop_column("unit_heat_rate_mmbtu_per_mwh") | ||
|
||
# ### 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
Oops, something went wrong.