Skip to content

Conversation

@brian-kim31
Copy link
Member

@brian-kim31 brian-kim31 commented Jan 22, 2026

⚡️ Optimization

PR Description

This PR enables the deletion of temporary tables created when a scan report upload fails. Currently, when a scan report upload fails, the temporary tables remain in the database and overtime cause consume space.

This was tested by having the DAG timeout set to one minute, observing the logs on airflow and checking the database to ensure the tables were deleted.

Related Issues or other material

Related #1228
Closes #1228

Screenshots, example outputs/behaviour etc.

Screenshot 2026-01-22 at 20 04 02 (2)

@brian-kim31 brian-kim31 requested a review from AndyRae January 23, 2026 18:46
query, parameters={"scan_report_id": scan_report_id}
)

table_pairs = [(record[0], record[1]) for record in records] if records else []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check - what is happening here?
Could you add a comment to describe it

Getting the first two values out of a list of lists is a little hard to understand why is all

logging.error(f"Failed to update job status on skipped task: {str(e)}")


def delete_temp_tables_on_failure(context):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this should be more generic - but let's demo first.

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.

Temporary tables aren't deleted on Scan Report upload failure

3 participants