[Issue #3148] Generate extracts of tables for opportunity data #3153
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.
Summary
Fixes #3148
Time to review: 10 mins
Changes proposed
Create a task we can run that will generate CSV extracts for a given set of tables
Context for reviewers
This dataset will be a sort of input to an analytics process being written. We'll pull these extract files and load them into the analytics database.
This uses pretty routine
copy
commands from Postgres which is very very efficient at reading/writing from CSV files.https://www.postgresql.org/docs/current/sql-copy.html
Additional information
Running
make cmd args="task create-analytics-db-csvs"
locally to get the script going with ~35k opportunities in my DB takes about 2 seconds for these 5 tables:Example files generated:
Opportunity
Current Opportunity Summary
Opportunity Summary
Opportunity Category
Opportunity Status