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

Block destructive syntax, or Block "phrases" #5988

Open
2 of 3 tasks
Nick-Lucas opened this issue Jun 26, 2024 · 0 comments
Open
2 of 3 tasks

Block destructive syntax, or Block "phrases" #5988

Nick-Lucas opened this issue Jun 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Nick-Lucas
Copy link

Nick-Lucas commented Jun 26, 2024

Search before asking

  • I searched the issues and found no similar issues.

Description

Consider the migration:

create or replace table important_table (
    insert_timestamp timestamp_ntz,
    name string,
);

What's wrong with this migration? Well you can't see it here but the table already exists, and the goal was just to add one new column, but the developer copied from the original migration and didn't consider that it's a destructive operation and will wipe the table. Instead an alter statement should have been used.

My team want to ensure that we catch issues which could lead to data-loss during development, and explicitely override/ignore with justification if needed.

We have tried using convention.blocked_words to achieve this, but neither blocked_words or blocked_regex have any support for whitespace, and so can't be used with "replace table" or "(replace\s table)"

Ideally there would be a way to warn about dangerous operations and ensure these are surfaced before or during code-review

Use case

No response

Dialect

snowflake

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@Nick-Lucas Nick-Lucas added the enhancement New feature or request label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant