From 2d2fb927ea18ee978d7904e3402fa9ea721854b2 Mon Sep 17 00:00:00 2001 From: Lyn Nagara Date: Tue, 20 Jun 2023 09:39:06 -0700 Subject: [PATCH] ref: Fix type checking errors and ensure `scripts` gets checked in CI (#4372) --- Makefile | 2 +- scripts/__init__.py | 0 scripts/copy_tables.py | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 scripts/__init__.py diff --git a/Makefile b/Makefile index 33eb0658c3..58312c876a 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ api-tests: SNUBA_SETTINGS=test pytest -vv tests/*_api.py backend-typing: - mypy snuba tests --strict --config-file mypy.ini --exclude 'tests/datasets|tests/query|tests/state|tests/snapshots|tests/clickhouse|tests/test_split.py|tests/test_copy_tables.py' + mypy snuba tests scripts --strict --config-file mypy.ini --exclude 'tests/datasets|tests/query|tests/state|tests/snapshots|tests/clickhouse|tests/test_split.py' install-python-dependencies: pip uninstall -qqy uwsgi # pip doesn't do well with swapping drop-ins diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/copy_tables.py b/scripts/copy_tables.py index 79aec85921..68c84613c2 100755 --- a/scripts/copy_tables.py +++ b/scripts/copy_tables.py @@ -22,6 +22,7 @@ def _get_client( def get_regex_match(curr_create_table_statement: str) -> str: match = re.search("\/clickhouse([a-z\/\-{}_]*)", curr_create_table_statement) + assert match is not None return match.group(0) @@ -79,6 +80,9 @@ def verify_local_tables_exist_from_mv( to_search = re.search("TO(.[.\w]*)", curr_create_table_statement) from_search = re.search("FROM(.[.\w]*)", curr_create_table_statement) + assert to_search is not None + assert from_search is not None + # make sure we ditch the "default." before checking against SHOW TABLES _, to_local_table = to_search.group(1).strip().split(".") _, from_local_table = from_search.group(1).strip().split(".")