-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor shared dbt script logic out into
utils
module (#590)
* Factor out town close reports to their own dedicated script * Update dbt/README.md with new `export_qc_town_close_reports` interface * Temp commit: Try moving --refresh-tables to the export_models script * Revert "Temp commit: Try moving --refresh-tables to the export_models script" This reverts commit bd7ad27. * Add output to docs for --refresh-tables flag for export_qc_town_close_reports * Rename --refresh-tables -> --print-table-refresh-command in export_qc_town_close_reports script * Use correct filters for sales table when printing table refresh command in export_qc_town_close_reports * Fix data structure for export_qc_town_close_reports refresh table command filters * Don't filter asmt_hist by cur = 'Y' in export_qc_town_close_reports, since that value doesn't exist * Remove unnecessary --no-run-glue-crawler flag in town close QC report refresh command * Generalize path in output example for --print-table-refresh-command docs * Ignore mypy warnings for select value we know is not null in export_models * Natural language fix to dbt/README.md * Fix import order in socrata_upload script * Fix typo in dbt/README.md Co-authored-by: Dan Snow <31494343+dfsnow@users.noreply.github.com> * Use typing builtin for list in dbt/scripts/export_models.py * Factor shared script logic out into `utils` module * Fix typing for kwargs that we unpack to argparse add_arguments --------- Co-authored-by: Dan Snow <31494343+dfsnow@users.noreply.github.com>
- Loading branch information
1 parent
b93c545
commit 0efd58e
Showing
6 changed files
with
273 additions
and
244 deletions.
There are no files selected for viewing
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
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
Empty file.
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,27 @@ | ||
# Constant values that are reused across scripts | ||
import argparse | ||
import typing | ||
|
||
|
||
# Define type for kwargs to argparse's add_argument method, since otherwise mypy | ||
# will be confused by the dict types when we unpack them. See here for details: | ||
# https://stackoverflow.com/a/74316829 | ||
class AddArgumentKwargs(typing.TypedDict, total=False): | ||
action: str | type[argparse.Action] | ||
default: typing.Any | ||
help: str | ||
|
||
|
||
# Definitions for common argparse arguments | ||
TARGET_ARGUMENT_ARGS = ["--target"] | ||
TARGET_ARGUMENT_KWARGS: AddArgumentKwargs = { | ||
"action": "store", | ||
"default": "dev", | ||
"help": "dbt target to use for running commands, defaults to 'dev'", | ||
} | ||
REBUILD_ARGUMENT_ARGS = ["--rebuild"] | ||
REBUILD_ARGUMENT_KWARGS: AddArgumentKwargs = { | ||
"action": argparse.BooleanOptionalAction, | ||
"default": False, | ||
"help": "Rebuild models prior to export", | ||
} |
Oops, something went wrong.