]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
fix(#10056): keep nullable as true for mariadb generated columns
authorindivar <indimishra@gmail.com>
Mon, 16 Oct 2023 18:53:04 +0000 (14:53 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Mon, 16 Oct 2023 18:53:04 +0000 (14:53 -0400)
commit5347be31c98a3627c2466f1891b7c0e80bf29ed9
tree2509a87bcf2d9009f7ad7588462fe1717d2fa81f
parentc94ec5f143691c99e3bbfa76945ac382f85bdd48
fix(#10056): keep nullable as true for mariadb generated columns

mariaDB does not support setting NOT NULL for generated column
ref: https://mariadb.com/kb/en/generated-columns/#statement-support

added a check in `get_column_specification` for mariadb, checking
if user has not specified nullable set it as True for computed column,
but if user has explicitly set as False raise a compile error.

added testcase for same

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->

### 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:

- [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.

**Have a nice day!**

Closes: #10354
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10354
Pull-request-sha: 68035e0f77884f361bdcad0514ea731814cb1a34

Change-Id: I00188cf899c0a2efe759e06e510243fbdb1a6dcf
doc/build/changelog/unreleased_20/10056.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_query.py