The constraint name in create_primary_key should be optional, but for batch operations is is required according to the type annotations
### Description
Changed the type annotation to `Optional[str]`
### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
This pull request is:
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [X] 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!**
Closes: #1452
Pull-request: https://github.com/sqlalchemy/alembic/pull/1452
Pull-request-sha:
8afb2bf3fbddc1b04a9da7c5cc5553dea2c1c593
Change-Id: Ic7bbbbfda85dafccdf44c73a6233140aa7e96a2d
...
def create_primary_key(
- self, constraint_name: str, columns: List[str]
+ self, constraint_name: Optional[str], columns: List[str]
) -> None:
"""Issue a "create primary key" instruction using the
current batch migration context.
def batch_create_primary_key(
cls,
operations: BatchOperations,
- constraint_name: str,
+ constraint_name: Optional[str],
columns: List[str],
) -> None:
"""Issue a "create primary key" instruction using the
enable-extensions = G
# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
ignore =
- A003,
+ A003,A005
D,
E203,E305,E704,E711,E712,E721,E722,E741,
N801,N802,N806,