Skip to content

Commit

Permalink
Migration: added core_eia861_short_form
Browse files Browse the repository at this point in the history
  • Loading branch information
Nancy9ice committed Apr 14, 2024
1 parent 9f84516 commit 574dbbc
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions migrations/versions/b10564738ef8_add_core_eia861_short_form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Add_core_eia861_short_form
Revision ID: b10564738ef8
Revises: 172898b30824
Create Date: 2024-04-14 17:04:45.030961
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b10564738ef8'
down_revision = '172898b30824'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('core_eia861__yearly_short_form',
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'),
sa.Column('utility_id_eia', sa.Integer(), nullable=False, comment='The EIA Utility Identification number.'),
sa.Column('utility_name_eia', sa.Text(), nullable=True, comment='The name of the utility.'),
sa.Column('entity_type', sa.Text(), nullable=True, comment='Entity type of principal owner.'),
sa.Column('state', sa.Text(), nullable=False, comment='Two letter US state abbreviation.'),
sa.Column('balancing_authority_code_eia', sa.Text(), nullable=False, comment='EIA short code identifying a balancing authority.'),
sa.Column('sales_revenue', sa.Float(), nullable=True, comment='Revenue from electricity sold.'),
sa.Column('sales_mwh', sa.Float(), nullable=True, comment='Quantity of electricity sold in MWh.'),
sa.Column('customers', sa.Float(), nullable=True, comment='Number of customers.'),
sa.Column('water_heater', sa.Integer(), nullable=True, comment="The number of grid-enabled water heaters added to the respondent's program this year - if the respondent has DSM program for grid-enabled water heaters (as defined by DOE’s Office of Energy Efficiency and Renewable Energy)."),
sa.Column('net_metering', sa.Boolean(), nullable=True, comment='Did this plant have a net metering agreement in effect during the reporting year? (Only displayed for facilities that report the sun or wind as an energy source). This field was only reported up until 2015'),
sa.Column('demand_side_management', sa.Boolean(), nullable=True, comment='Were there strategies and measures to influence or manage the consumption patterns of electricity consumers?'),
sa.Column('time_responsive_programs', sa.Boolean(), nullable=True, comment='Whether the respondent operates any time-based rate programs (e.g., real-time pricing, critical peak pricing, variable peak pricing and time-of-use rates administered through a tariff).'),
sa.Column('green_pricing', sa.Boolean(), nullable=True, comment='Was there green pricing program during the reporting year?'),
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.'),
sa.ForeignKeyConstraint(['balancing_authority_code_eia'], ['core_eia__codes_balancing_authorities.code'], name=op.f('fk_core_eia861__yearly_short_form_balancing_authority_code_eia_core_eia__codes_balancing_authorities')),
sa.ForeignKeyConstraint(['data_maturity'], ['core_pudl__codes_data_maturities.code'], name=op.f('fk_core_eia861__yearly_short_form_data_maturity_core_pudl__codes_data_maturities')),
sa.ForeignKeyConstraint(['utility_id_eia', 'report_date'], ['core_eia860__scd_utilities.utility_id_eia', 'core_eia860__scd_utilities.report_date'], name=op.f('fk_core_eia861__yearly_short_form_utility_id_eia_core_eia860__scd_utilities')),
sa.PrimaryKeyConstraint('utility_id_eia', 'state', 'report_date', 'balancing_authority_code_eia', name=op.f('pk_core_eia861__yearly_short_form'))
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('core_eia861__yearly_short_form')
# ### end Alembic commands ###

0 comments on commit 574dbbc

Please sign in to comment.