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

fix(ingest/redshift): avoid asserts in redshift schemas #11219

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,23 +313,19 @@ def get_table_stats(enriched_tables, field_names, schema, table):
size_in_bytes: Optional[int] = None
rows_count: Optional[int] = None
if schema in enriched_tables and table_name in enriched_tables[schema]:
if enriched_tables[schema][table_name].last_accessed is not None:
# Mypy seems to be not clever enough to understand the above check
last_accessed = enriched_tables[schema][table_name].last_accessed
assert last_accessed
if (
last_accessed := enriched_tables[schema][table_name].last_accessed
) is not None:
last_altered = last_accessed.replace(tzinfo=timezone.utc)
elif creation_time:
last_altered = creation_time

if enriched_tables[schema][table_name].size is not None:
# Mypy seems to be not clever enough to understand the above check
size = enriched_tables[schema][table_name].size
if size:
size_in_bytes = size * 1024 * 1024
if (size := enriched_tables[schema][table_name].size) is not None:
size_in_bytes = size * 1024 * 1024

if enriched_tables[schema][table_name].estimated_visible_rows is not None:
rows = enriched_tables[schema][table_name].estimated_visible_rows
assert rows
if (
rows := enriched_tables[schema][table_name].estimated_visible_rows
) is not None:
rows_count = int(rows)
else:
# The object was not found in the enriched data.
Expand Down
Loading