-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Issue #1299] add script to populate source tables with mock data #1464
base: main
Are you sure you want to change the base?
Conversation
import src.adapters.db as db | ||
import src.adapters.db.flask_db as flask_db | ||
from src.data_migration.data_migration_blueprint import data_migration_blueprint | ||
from tests.src.db.models.factories import ForeignTopportunityFactory |
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.
This might hit some issues non-locally if merged. The factory libraries are dev dependencies, and I think that would cause issues in the non-local builds.
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.
To work around that for the seed script I built, I just don't use flask and manually setup the logging/db session: https://github.com/HHS/simpler-grants-gov/blob/main/api/tests/lib/seed_local_db.py
Only adds a few lines.
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.
Should this just be in the same folder and naming convention as seed_local_db.py, ie seed_local_source_tables.py
?
Summary
Fixes #1299
Time to review: x mins
Changes proposed
Context for reviewers
Intended for use with testing POCs for transform technologies.
Run using
make db-seed-local-source-tables
.The first time run, it will generate 100,000 opportunities in the local "foreign" tables (
foreign_topportunity
, ...).The 2nd, 3rd, ... time run, it will generate 2,000 more, as well as update about 1% of the existing opportunities.
001
are updated every time.
Additional information