-
-
Notifications
You must be signed in to change notification settings - Fork 110
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 #2904 from catalyst-cooperative/rename-mcoe-assets
Rename MCOE and plant part list assets
- Loading branch information
Showing
16 changed files
with
1,280 additions
and
81 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
799 changes: 799 additions & 0 deletions
799
migrations/versions/56d425818439_rename_mcoe_and_ppl_assets.py
Large diffs are not rendered by default.
Oops, something went wrong.
117 changes: 117 additions & 0 deletions
117
migrations/versions/6c66da98c4e1_rename_fuel_cost_by_generator_asset.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,117 @@ | ||
"""Rename fuel cost by generator asset | ||
Revision ID: 6c66da98c4e1 | ||
Revises: 56d425818439 | ||
Create Date: 2023-10-02 18:31:16.729897 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '6c66da98c4e1' | ||
down_revision = '56d425818439' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('_out_eia__monthly_fuel_cost_by_generator', | ||
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'), | ||
sa.Column('plant_id_eia', sa.Integer(), nullable=False, comment='The unique six-digit facility identification number, also called an ORISPL, assigned by the Energy Information Administration.'), | ||
sa.Column('generator_id', sa.Text(), nullable=False, comment='Generator ID is usually numeric, but sometimes includes letters. Make sure you treat it as a string!'), | ||
sa.Column('unit_id_pudl', sa.Integer(), nullable=True, comment='Dynamically assigned PUDL unit id. WARNING: This ID is not guaranteed to be static long term as the input data and algorithm may evolve over time.'), | ||
sa.Column('plant_name_eia', sa.Text(), nullable=True, comment='Plant name.'), | ||
sa.Column('plant_id_pudl', sa.Integer(), nullable=True, comment='A manually assigned PUDL plant ID. May not be constant over time.'), | ||
sa.Column('utility_id_eia', sa.Integer(), nullable=True, comment='The EIA Utility Identification number.'), | ||
sa.Column('utility_name_eia', sa.Text(), nullable=True, comment='The name of the utility.'), | ||
sa.Column('utility_id_pudl', sa.Integer(), nullable=True, comment='A manually assigned PUDL utility ID. May not be stable over time.'), | ||
sa.Column('fuel_type_count', sa.Integer(), nullable=True, comment='A count of how many different simple energy sources there are associated with a generator.'), | ||
sa.Column('fuel_type_code_pudl', sa.Enum('coal', 'gas', 'hydro', 'nuclear', 'oil', 'other', 'solar', 'waste', 'wind'), nullable=True, comment='Simplified fuel type code used in PUDL'), | ||
sa.Column('fuel_cost_from_eiaapi', sa.Boolean(), nullable=True, comment='Indicates whether the fuel cost was derived from the EIA API.'), | ||
sa.Column('fuel_cost_per_mmbtu', sa.Float(), nullable=True, comment='Average fuel cost per mmBTU of heat content in nominal USD.'), | ||
sa.Column('heat_rate_mmbtu_mwh', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.'), | ||
sa.Column('fuel_cost_per_mwh', sa.Float(), nullable=True, comment='Derived from MCOE, a unit level value. Average fuel cost per MWh of heat content in nominal USD.'), | ||
sa.ForeignKeyConstraint(['plant_id_eia', 'generator_id'], ['core_eia__entity_generators.plant_id_eia', 'core_eia__entity_generators.generator_id'], name=op.f('fk__out_eia__monthly_fuel_cost_by_generator_plant_id_eia_core_eia__entity_generators')), | ||
sa.ForeignKeyConstraint(['plant_id_pudl'], ['core_pudl__entity_plants_pudl.plant_id_pudl'], name=op.f('fk__out_eia__monthly_fuel_cost_by_generator_plant_id_pudl_core_pudl__entity_plants_pudl')), | ||
sa.ForeignKeyConstraint(['utility_id_eia'], ['core_eia__entity_utilities.utility_id_eia'], name=op.f('fk__out_eia__monthly_fuel_cost_by_generator_utility_id_eia_core_eia__entity_utilities')), | ||
sa.ForeignKeyConstraint(['utility_id_pudl'], ['core_pudl__entity_utilities_pudl.utility_id_pudl'], name=op.f('fk__out_eia__monthly_fuel_cost_by_generator_utility_id_pudl_core_pudl__entity_utilities_pudl')), | ||
sa.PrimaryKeyConstraint('report_date', 'plant_id_eia', 'generator_id', name=op.f('pk__out_eia__monthly_fuel_cost_by_generator')) | ||
) | ||
op.create_table('_out_eia__yearly_fuel_cost_by_generator', | ||
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'), | ||
sa.Column('plant_id_eia', sa.Integer(), nullable=False, comment='The unique six-digit facility identification number, also called an ORISPL, assigned by the Energy Information Administration.'), | ||
sa.Column('generator_id', sa.Text(), nullable=False, comment='Generator ID is usually numeric, but sometimes includes letters. Make sure you treat it as a string!'), | ||
sa.Column('unit_id_pudl', sa.Integer(), nullable=True, comment='Dynamically assigned PUDL unit id. WARNING: This ID is not guaranteed to be static long term as the input data and algorithm may evolve over time.'), | ||
sa.Column('plant_name_eia', sa.Text(), nullable=True, comment='Plant name.'), | ||
sa.Column('plant_id_pudl', sa.Integer(), nullable=True, comment='A manually assigned PUDL plant ID. May not be constant over time.'), | ||
sa.Column('utility_id_eia', sa.Integer(), nullable=True, comment='The EIA Utility Identification number.'), | ||
sa.Column('utility_name_eia', sa.Text(), nullable=True, comment='The name of the utility.'), | ||
sa.Column('utility_id_pudl', sa.Integer(), nullable=True, comment='A manually assigned PUDL utility ID. May not be stable over time.'), | ||
sa.Column('fuel_type_count', sa.Integer(), nullable=True, comment='A count of how many different simple energy sources there are associated with a generator.'), | ||
sa.Column('fuel_type_code_pudl', sa.Enum('coal', 'gas', 'hydro', 'nuclear', 'oil', 'other', 'solar', 'waste', 'wind'), nullable=True, comment='Simplified fuel type code used in PUDL'), | ||
sa.Column('fuel_cost_from_eiaapi', sa.Boolean(), nullable=True, comment='Indicates whether the fuel cost was derived from the EIA API.'), | ||
sa.Column('fuel_cost_per_mmbtu', sa.Float(), nullable=True, comment='Average fuel cost per mmBTU of heat content in nominal USD.'), | ||
sa.Column('heat_rate_mmbtu_mwh', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.'), | ||
sa.Column('fuel_cost_per_mwh', sa.Float(), nullable=True, comment='Derived from MCOE, a unit level value. Average fuel cost per MWh of heat content in nominal USD.'), | ||
sa.ForeignKeyConstraint(['plant_id_eia', 'generator_id', 'report_date'], ['core_eia860__scd_generators.plant_id_eia', 'core_eia860__scd_generators.generator_id', 'core_eia860__scd_generators.report_date'], name=op.f('fk__out_eia__yearly_fuel_cost_by_generator_plant_id_eia_core_eia860__scd_generators')), | ||
sa.ForeignKeyConstraint(['plant_id_pudl'], ['core_pudl__entity_plants_pudl.plant_id_pudl'], name=op.f('fk__out_eia__yearly_fuel_cost_by_generator_plant_id_pudl_core_pudl__entity_plants_pudl')), | ||
sa.ForeignKeyConstraint(['utility_id_eia', 'report_date'], ['core_eia860__scd_utilities.utility_id_eia', 'core_eia860__scd_utilities.report_date'], name=op.f('fk__out_eia__yearly_fuel_cost_by_generator_utility_id_eia_core_eia860__scd_utilities')), | ||
sa.ForeignKeyConstraint(['utility_id_pudl'], ['core_pudl__entity_utilities_pudl.utility_id_pudl'], name=op.f('fk__out_eia__yearly_fuel_cost_by_generator_utility_id_pudl_core_pudl__entity_utilities_pudl')), | ||
sa.PrimaryKeyConstraint('report_date', 'plant_id_eia', 'generator_id', name=op.f('pk__out_eia__yearly_fuel_cost_by_generator')) | ||
) | ||
op.drop_table('fuel_cost_by_generator_yearly') | ||
op.drop_table('fuel_cost_by_generator_monthly') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('fuel_cost_by_generator_monthly', | ||
sa.Column('report_date', sa.DATE(), nullable=False), | ||
sa.Column('plant_id_eia', sa.INTEGER(), nullable=False), | ||
sa.Column('generator_id', sa.TEXT(), nullable=False), | ||
sa.Column('unit_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('plant_name_eia', sa.TEXT(), nullable=True), | ||
sa.Column('plant_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('utility_id_eia', sa.INTEGER(), nullable=True), | ||
sa.Column('utility_name_eia', sa.TEXT(), nullable=True), | ||
sa.Column('utility_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('fuel_type_count', sa.INTEGER(), nullable=True), | ||
sa.Column('fuel_type_code_pudl', sa.VARCHAR(length=7), nullable=True), | ||
sa.Column('fuel_cost_from_eiaapi', sa.BOOLEAN(), nullable=True), | ||
sa.Column('fuel_cost_per_mmbtu', sa.FLOAT(), nullable=True), | ||
sa.Column('heat_rate_mmbtu_mwh', sa.FLOAT(), nullable=True), | ||
sa.Column('fuel_cost_per_mwh', sa.FLOAT(), nullable=True), | ||
sa.ForeignKeyConstraint(['plant_id_eia', 'generator_id', 'report_date'], ['core_eia860__scd_generators.plant_id_eia', 'core_eia860__scd_generators.generator_id', 'core_eia860__scd_generators.report_date'], name='fk_fuel_cost_by_generator_monthly_plant_id_eia_core_eia860__scd_generators'), | ||
sa.ForeignKeyConstraint(['plant_id_pudl'], ['core_pudl__entity_plants_pudl.plant_id_pudl'], name='fk_fuel_cost_by_generator_monthly_plant_id_pudl_core_pudl__entity_plants_pudl'), | ||
sa.ForeignKeyConstraint(['utility_id_eia', 'report_date'], ['core_eia860__scd_utilities.utility_id_eia', 'core_eia860__scd_utilities.report_date'], name='fk_fuel_cost_by_generator_monthly_utility_id_eia_core_eia860__scd_utilities'), | ||
sa.ForeignKeyConstraint(['utility_id_pudl'], ['core_pudl__entity_utilities_pudl.utility_id_pudl'], name='fk_fuel_cost_by_generator_monthly_utility_id_pudl_core_pudl__entity_utilities_pudl'), | ||
sa.PrimaryKeyConstraint('report_date', 'plant_id_eia', 'generator_id', name='pk_fuel_cost_by_generator_monthly') | ||
) | ||
op.create_table('fuel_cost_by_generator_yearly', | ||
sa.Column('report_date', sa.DATE(), nullable=False), | ||
sa.Column('plant_id_eia', sa.INTEGER(), nullable=False), | ||
sa.Column('generator_id', sa.TEXT(), nullable=False), | ||
sa.Column('unit_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('plant_name_eia', sa.TEXT(), nullable=True), | ||
sa.Column('plant_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('utility_id_eia', sa.INTEGER(), nullable=True), | ||
sa.Column('utility_name_eia', sa.TEXT(), nullable=True), | ||
sa.Column('utility_id_pudl', sa.INTEGER(), nullable=True), | ||
sa.Column('fuel_type_count', sa.INTEGER(), nullable=True), | ||
sa.Column('fuel_type_code_pudl', sa.VARCHAR(length=7), nullable=True), | ||
sa.Column('fuel_cost_from_eiaapi', sa.BOOLEAN(), nullable=True), | ||
sa.Column('fuel_cost_per_mmbtu', sa.FLOAT(), nullable=True), | ||
sa.Column('heat_rate_mmbtu_mwh', sa.FLOAT(), nullable=True), | ||
sa.Column('fuel_cost_per_mwh', sa.FLOAT(), nullable=True), | ||
sa.ForeignKeyConstraint(['plant_id_eia', 'generator_id', 'report_date'], ['core_eia860__scd_generators.plant_id_eia', 'core_eia860__scd_generators.generator_id', 'core_eia860__scd_generators.report_date'], name='fk_fuel_cost_by_generator_yearly_plant_id_eia_core_eia860__scd_generators'), | ||
sa.ForeignKeyConstraint(['plant_id_pudl'], ['core_pudl__entity_plants_pudl.plant_id_pudl'], name='fk_fuel_cost_by_generator_yearly_plant_id_pudl_core_pudl__entity_plants_pudl'), | ||
sa.ForeignKeyConstraint(['utility_id_eia', 'report_date'], ['core_eia860__scd_utilities.utility_id_eia', 'core_eia860__scd_utilities.report_date'], name='fk_fuel_cost_by_generator_yearly_utility_id_eia_core_eia860__scd_utilities'), | ||
sa.ForeignKeyConstraint(['utility_id_pudl'], ['core_pudl__entity_utilities_pudl.utility_id_pudl'], name='fk_fuel_cost_by_generator_yearly_utility_id_pudl_core_pudl__entity_utilities_pudl'), | ||
sa.PrimaryKeyConstraint('report_date', 'plant_id_eia', 'generator_id', name='pk_fuel_cost_by_generator_yearly') | ||
) | ||
op.drop_table('_out_eia__yearly_fuel_cost_by_generator') | ||
op.drop_table('_out_eia__monthly_fuel_cost_by_generator') | ||
# ### end Alembic commands ### |
Oops, something went wrong.