-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved the feed data for the lookup tables from csv file into src/conf… #67
Merged
lchen-2101
merged 6 commits into
main
from
feature/66_add_more_alembic_custom_tests_and_add_seed_data_inside_script
Jan 4, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b570fd6
Moved the feed data for the lookup tables from csv file into src/conf…
f96e709
Address the comment by moving the seed data from config.py to db_revi…
f584799
Modified comments, changed feed to seed
21052bb
Addressed the comments
4fd0d11
addressed tge comment
8ee8223
Addressed the comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
28 changes: 0 additions & 28 deletions
28
db_revisions/versions/26a742d97ad9_feed_federal_regulator_table.py
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.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,43 @@ | ||
"""Seed Federal Regulator table | ||
|
||
Revision ID: 26a742d97ad9 | ||
Revises: 7b6ff51002b5 | ||
Create Date: 2023-12-14 01:23:17.872728 | ||
|
||
""" | ||
from typing import Sequence, Union | ||
from alembic import op | ||
from sqlalchemy import MetaData, Table | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "26a742d97ad9" | ||
down_revision: Union[str, None] = "7b6ff51002b5" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
seed_data = [ | ||
{"id": "FCA", "name": "Farm Credit Administration"}, | ||
{"id": "FDIC", "name": "Federal Deposit Insurance Corporation"}, | ||
{"id": "FHFA", "name": "Federal Housing Finance Agency"}, | ||
{"id": "FRS", "name": "Federal Reserve System"}, | ||
{"id": "NCUA", "name": "National Credit Union Administration"}, | ||
{"id": "OCC", "name": "Office of the Comptroller of the Currency"}, | ||
{"id": "OTS", "name": "Office of Thrift Supervision (only valid until July 21, 2011)"}, | ||
] | ||
|
||
meta = MetaData() | ||
meta.reflect(op.get_bind()) | ||
table = Table("federal_regulator", meta) | ||
|
||
op.bulk_insert(table, seed_data) | ||
|
||
|
||
def downgrade() -> None: | ||
meta = MetaData() | ||
meta.reflect(op.get_bind()) | ||
table = Table("federal_regulator", meta) | ||
|
||
op.execute(table.delete()) |
28 changes: 0 additions & 28 deletions
28
db_revisions/versions/7b6ff51002b5_feed_address_state_table.py
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
db_revisions/versions/7b6ff51002b5_seed_address_state_table.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,93 @@ | ||
"""Seed Address State table | ||
|
||
Revision ID: 7b6ff51002b5 | ||
Revises: 045aa502e050 | ||
Create Date: 2023-12-14 01:21:48.325752 | ||
|
||
""" | ||
from typing import Sequence, Union | ||
from alembic import op | ||
from sqlalchemy import MetaData, Table | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "7b6ff51002b5" | ||
down_revision: Union[str, None] = "045aa502e050" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
seed_data = [ | ||
{"code": "AL", "name": "Alabama"}, | ||
{"code": "AK", "name": "Alaska"}, | ||
{"code": "AZ", "name": "Arizona"}, | ||
{"code": "AR", "name": "Arkansas"}, | ||
{"code": "CA", "name": "California"}, | ||
{"code": "CO", "name": "Colorado"}, | ||
{"code": "CT", "name": "Connecticut"}, | ||
{"code": "DE", "name": "Delaware"}, | ||
{"code": "FL", "name": "Florida"}, | ||
{"code": "GA", "name": "Georgia"}, | ||
{"code": "HI", "name": "Hawaii"}, | ||
{"code": "ID", "name": "Idaho"}, | ||
{"code": "IL", "name": "Illinois"}, | ||
{"code": "IN", "name": "Indiana"}, | ||
{"code": "IA", "name": "Iowa"}, | ||
{"code": "KS", "name": "Kansas"}, | ||
{"code": "KY", "name": "Kentucky"}, | ||
{"code": "LA", "name": "Louisiana"}, | ||
{"code": "ME", "name": "Maine"}, | ||
{"code": "MD", "name": "Maryland"}, | ||
{"code": "MA", "name": "Massachusetts"}, | ||
{"code": "MI", "name": "Michigan"}, | ||
{"code": "MN", "name": "Minnesota"}, | ||
{"code": "MS", "name": "Mississippi"}, | ||
{"code": "MO", "name": "Missouri"}, | ||
{"code": "MT", "name": "Montana"}, | ||
{"code": "NE", "name": "Nebraska"}, | ||
{"code": "NV", "name": "Nevada"}, | ||
{"code": "NH", "name": "New Hampshire"}, | ||
{"code": "NJ", "name": "New Jersey"}, | ||
{"code": "NM", "name": "New Mexico"}, | ||
{"code": "NY", "name": "New York"}, | ||
{"code": "NC", "name": "North Carolina"}, | ||
{"code": "ND", "name": "North Dakota"}, | ||
{"code": "OH", "name": "Ohio"}, | ||
{"code": "OK", "name": "Oklahoma"}, | ||
{"code": "OR", "name": "Oregon"}, | ||
{"code": "PA", "name": "Pennsylvania"}, | ||
{"code": "RI", "name": "Rhode Island"}, | ||
{"code": "SC", "name": "South Carolina"}, | ||
{"code": "SD", "name": "South Dakota"}, | ||
{"code": "TN", "name": "Tennessee"}, | ||
{"code": "TX", "name": "Texas"}, | ||
{"code": "UT", "name": "Utah"}, | ||
{"code": "VT", "name": "Vermont"}, | ||
{"code": "VA", "name": "Virginia"}, | ||
{"code": "WA", "name": "Washington"}, | ||
{"code": "WV", "name": "West Virginia"}, | ||
{"code": "WI", "name": "Wisconsin"}, | ||
{"code": "WY", "name": "Wyoming"}, | ||
{"code": "DC", "name": "District of Columbia"}, | ||
{"code": "AS", "name": "American Samoa"}, | ||
{"code": "GU", "name": "Guam"}, | ||
{"code": "MP", "name": "Northern Mariana Islands"}, | ||
{"code": "PR", "name": "Puerto Rico"}, | ||
{"code": "UM", "name": "United States Minor Outlying Islands"}, | ||
{"code": "VI", "name": "Virgin Islands, U.S."}, | ||
] | ||
|
||
meta = MetaData() | ||
meta.reflect(op.get_bind()) | ||
table = Table("address_state", meta) | ||
|
||
op.bulk_insert(table, seed_data) | ||
|
||
|
||
def downgrade() -> None: | ||
meta = MetaData() | ||
meta.reflect(op.get_bind()) | ||
table = Table("address_state", meta) | ||
|
||
op.execute(table.delete()) |
27 changes: 0 additions & 27 deletions
27
db_revisions/versions/a41281b1e109_feed_sbl_institution_type_table.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guessing u r in the process of replacing these with the
get_table_by_name
in utils? looks good otherwise, so ready to merge once the last changes are implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thanks