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(data-warehouse): Remove line for deleting views when a table is deleted #29170

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

Gilbert09
Copy link
Member

Problem

Changes

  • I think its this line thats deleting them, I dont see anywhere else DataWarehouseSavedQuery are getting deleted other than the saved query destroy endpoint
  • I dont think we should ever be deleting these models without a user asking them to be deleted anyway, so this should get removed regardless of whether it fixes the underlying issue here

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

I didn't

@Gilbert09 Gilbert09 requested a review from a team February 25, 2025 10:30
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR removes code that was automatically deleting DataWarehouseSavedQuery instances when a related DataWarehouseTable was deleted, addressing an issue where views were unexpectedly disappearing from the database.

  • Removed the import of DataWarehouseSavedQuery from posthog/warehouse/api/table.py
  • Removed the line in the destroy method that filtered and deleted saved queries containing the table name
  • This change aligns with the principle that saved queries should only be deleted when explicitly requested by a user
  • The PR addresses a specific issue reported in Slack where views were being randomly deleted from PostgreSQL
  • The change is appropriate for both cloud and self-hosted environments

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@Gilbert09 Gilbert09 enabled auto-merge (squash) February 25, 2025 16:28
@Gilbert09 Gilbert09 merged commit 58f3462 into master Feb 25, 2025
89 checks passed
@Gilbert09 Gilbert09 deleted the tom/stop-deleting-views branch February 25, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants