-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Added parameters if_exists and if_not_exists for index operations. #1260
Conversation
Hi @CaselIT |
sorry, I must have missed this. I'll take a look soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work. Sorry for the delay.
A changelog is missing. see examples in https://github.com/sqlalchemy/alembic/tree/main/docs/build/unreleased . Also feel free to add "Pull request courtesy of <you>" if you like
kw = {} | ||
if operation.if_not_exists is not None: | ||
if not sqla_2: | ||
raise NotImplementedError("SQLAlchemy 2.0+ required") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what's the usual behavior here when alembinc is trying to do something not supported by the installed sqlalchemy version.
@zzzeek do you remember if there is a rule for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found the rule but there is a similar case
alembic/alembic/operations/base.py
Lines 520 to 521 in f5e7fd6
if not sqla_compat.sqla_14_18: | |
raise NotImplementedError("SQLAlchemy 1.4.18+ required") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 8c087e4 of this pull request into gerrit so we can run tests and reviews and stuff
Failed to create a gerrit review, git squash against branch 'main' failed |
the genreal idea here seems OK, let's run it through... |
is this something with a newer git version maybe? |
OK Im really not sure why PRs aren't squshing now, can you please rebase this on main? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision 5ed62d1 of this pull request into gerrit so we can run tests and reviews and stuff
New Gerrit review created for change 5ed62d1: https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4782 |
managed to rebase |
Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4782 has been merged. Congratulations! :) |
Fixes: #151
Description
As mentioned in #151, IF EXISTS/IF NOT EXISTS syntax was implemented in SQLAlchemy 2.0. This request adds an ability to use them for index operations.
If the issue implies to implement all the possible cases with these directives, I could continue working on it 🙂
Checklist
This pull request is:
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
Fixes: #<issue number>
in the commit messageinclude a complete example of how the feature would look.
Fixes: #<issue number>
in the commit messageHave a nice day!