Skip to content

Commit

Permalink
Addressed the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nargis Sultani committed Jan 4, 2024
1 parent 4fd0d11 commit 8ee8223
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from typing import Sequence, Union
from alembic import op
from sqlalchemy import MetaData, Table
from utils import get_table_by_name


# revision identifiers, used by Alembic.
Expand All @@ -28,16 +28,12 @@ def upgrade() -> None:
{"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)
table = get_table_by_name("federal_regulator")

op.bulk_insert(table, seed_data)


def downgrade() -> None:
meta = MetaData()
meta.reflect(op.get_bind())
table = Table("federal_regulator", meta)
table = get_table_by_name("federal_regulator")

op.execute(table.delete())
10 changes: 3 additions & 7 deletions db_revisions/versions/7b6ff51002b5_seed_address_state_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from typing import Sequence, Union
from alembic import op
from sqlalchemy import MetaData, Table
from utils import get_table_by_name


# revision identifiers, used by Alembic.
Expand Down Expand Up @@ -78,16 +78,12 @@ def upgrade() -> None:
{"code": "VI", "name": "Virgin Islands, U.S."},
]

meta = MetaData()
meta.reflect(op.get_bind())
table = Table("address_state", meta)
table = get_table_by_name("address_state")

op.bulk_insert(table, seed_data)


def downgrade() -> None:
meta = MetaData()
meta.reflect(op.get_bind())
table = Table("address_state", meta)
table = get_table_by_name("address_state")

op.execute(table.delete())
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from typing import Sequence, Union
from alembic import op
from sqlalchemy import MetaData, Table
from utils import get_table_by_name

# revision identifiers, used by Alembic.
revision: str = "a41281b1e109"
Expand All @@ -33,16 +33,12 @@ def upgrade() -> None:
{"id": "13", "name": "Other"},
]

meta = MetaData()
meta.reflect(op.get_bind())
table = Table("sbl_institution_type", meta)
table = get_table_by_name("sbl_institution_type")

op.bulk_insert(table, seed_data)


def downgrade() -> None:
meta = MetaData()
meta.reflect(op.get_bind())
table = Table("sbl_institution_type", meta)
table = get_table_by_name("sbl_institution_type")

op.execute(table.delete())
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from typing import Sequence, Union
from alembic import op
from sqlalchemy import MetaData, Table
from utils import get_table_by_name


# revision identifiers, used by Alembic.
Expand Down Expand Up @@ -38,16 +38,13 @@ def upgrade() -> None:
{"id": "17", "name": "MBS of federally chartered thrift (OCC supervised)"},
{"id": "18", "name": "Affiliate of depository institution. MBS is in the same ownership org as a depository."},
]
meta = MetaData()
meta.reflect(op.get_bind())
table = Table("hmda_institution_type", meta)

table = get_table_by_name("hmda_institution_type")

op.bulk_insert(table, seed_data)


def downgrade() -> None:
meta = MetaData()
meta.reflect(op.get_bind())
table = Table("hmda_institution_type", meta)
table = get_table_by_name("hmda_institution_type")

op.execute(table.delete())

0 comments on commit 8ee8223

Please sign in to comment.