Skip to content
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

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jamesbursa
Copy link
Collaborator

@jamesbursa jamesbursa commented Mar 12, 2024

Summary

Fixes #1299

Time to review: x mins

Changes proposed

What was added, updated, or removed in this PR.

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.

  • Records ending in 001 are updated every time.
  • The 20 records with the highest ids are also updated.
    

Additional information

Screenshots, GIF demos, code examples or output to help show the changes working as expected.

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
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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 ?

@github-actions github-actions bot added the ci/cd label Mar 29, 2024
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 3, 2024
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Specify and document a list of evaluation criteria for Transform technology
4 participants