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

Render if_not_exists option for CreateIndexOp and DropIndexOp #1446

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lachaib
Copy link

@lachaib lachaib commented Mar 19, 2024

Fixes: #151

Description

Without opinion on whether or not the option if_not_exists or if_exists should be set by default (or configurable via AutogenContext), I think a follow-up on
#151 should be that if_not_exists or if_exists attributes should be that they are rendered during autogen steps.

How I intend to use it: specify the attribute during rewrites of the pipeline

@writer.rewrites(ops.CreateIndexOp)
def create_index_if_not_exist(_autogen_context, _revision, op: ops.CreateIndexOp):
    op.if_not_exists = True
    return op


@writer.rewrites(ops.DropIndexOp)
def drop_index_if_exist(_autogen_context, _revision, op: ops.DropIndexOp):
    op.if_exists = True
    return op

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

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.

IF EXISTS/IF NOT EXISTS directives
1 participant