-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implements logic to request all dailies from WFWX and marshall results into `NoonForecast`s - Only persists records from WFWX that have `recordType.id` set as `FORECAST` - Refactor `bcfw_p1*` to `wfwx*` and remove `bcfw_p1` test fixture artifacts - Refactor `bot` -> `job` since they are cronjobs and make this consistent in codebase - Remove ambiguous bot names - Remove jenkins - Adds `wfwx_update_date` column to `noon_forecasts` and updates whole row unique constraint to store new records of forecasts - Migration first adds this column as nullable, since existing data does not have values here, then sets the column to be equal to the `creation_date` for existing records, then enforces a non-nullable constraint. All new records will have `wfwx_update_date` set to the `updateDate` that WFWX promises to return. - Tested the migration with local data -- switched to main branch with existing db schema, copied partial data from pods, switched to this branch, ran migrations without issue, ran `noon_forecasts` job with start timestamp 1638301981 to verify old and new data records work. - Tested with dummy forecasts live.
- Loading branch information
Showing
47 changed files
with
1,248 additions
and
2,940 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
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
36 changes: 36 additions & 0 deletions
36
api/alembic/versions/39806f02cdec_wfwx_update_date_part_of_unique_.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,36 @@ | ||
"""wfwx_update_date part of unique constraint | ||
Revision ID: 39806f02cdec | ||
Revises: d99fcdc4800d | ||
Create Date: 2021-12-14 11:38:35.435805 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '39806f02cdec' | ||
down_revision = 'd99fcdc4800d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.drop_constraint('noon_forecasts_weather_date_station_code_temp_valid_tempera_key', | ||
'noon_forecasts', type_='unique') | ||
op.create_unique_constraint('unique_forecast', 'noon_forecasts', [ | ||
'weather_date', 'wfwx_update_date', 'station_code']) | ||
op.drop_column('noon_forecasts', 'danger_rating', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
|
||
|
||
def downgrade(): | ||
op.add_column('noon_forecasts', | ||
sa.Column('danger_rating', | ||
sa.INTEGER(), | ||
nullable=True)) | ||
op.drop_constraint('unique_forecast', 'noon_forecasts', type_='unique') | ||
op.create_unique_constraint('noon_forecasts_weather_date_station_code_temp_valid_tempera_key', 'noon_forecasts', [ | ||
'weather_date', 'station_code', 'temp_valid', 'temperature', 'rh_valid', 'relative_humidity', 'wdir_valid', 'wind_direction', 'wspeed_valid', 'wind_speed', 'precip_valid', 'precipitation', 'gc', 'ffmc', 'dmc', 'dc', 'isi', 'bui', 'fwi', 'danger_rating']) |
29 changes: 29 additions & 0 deletions
29
api/alembic/versions/d99fcdc4800d_add_non_nullable_wfwx_update_date.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,29 @@ | ||
"""Add non-nullable wfwx update date | ||
Revision ID: d99fcdc4800d | ||
Revises: 1caf3488a340 | ||
Create Date: 2021-12-14 11:27:03.917981 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'd99fcdc4800d' | ||
down_revision = '1caf3488a340' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column('noon_forecasts', sa.Column('wfwx_update_date', sa.TIMESTAMP(timezone=True), nullable=True)) | ||
op.execute("UPDATE noon_forecasts SET wfwx_update_date = created_at") | ||
op.alter_column('noon_forecasts', 'wfwx_update_date', nullable=False) | ||
op.create_index(op.f('ix_noon_forecasts_wfwx_update_date'), | ||
'noon_forecasts', ['wfwx_update_date'], unique=False) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index(op.f('ix_noon_forecasts_wfwx_update_date'), table_name='noon_forecasts') | ||
op.drop_column('noon_forecasts', 'wfwx_update_date') |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.