]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
refactor: simplify and clean up dialect-specific code
authorShamil <ashm.tech@proton.me>
Thu, 17 Apr 2025 15:23:21 +0000 (11:23 -0400)
committerMichael Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Apr 2025 15:08:22 +0000 (15:08 +0000)
commitbb5bfb4beb35450ee8db7a173b9b438e065a90a9
treee988997f947fe75436d9fa51eeff3215aee298c7
parent3217acc1131048aa67744e032fe8816407d8dfba
refactor: simplify and clean up dialect-specific code

**Title:** Removed unused variables and redundant functions across multiple dialects. Improves code readability and reduces maintenance complexity without altering functionality.
### Description
This pull request introduces several minor refactorings across different dialect modules:
- **MSSQL:**
    - Simplified the initialization of the `fkeys` dictionary in `_get_foreign_keys` using `util.defaultdict` directly.

- **MySQL:** Removed the unused variable in `_get_table_comment`. `rp`
- **PostgreSQL (_psycopg_common):** Removed the unused variable `cursor` in `do_ping`.
- **PostgreSQL (base):** Removed the unused variable `args` in `_get_column_info`.
- **SQLite:** Removed the unused variable `new_filename` in `generate_driver_url`.

These changes focus purely on code cleanup and simplification, removing dead code and improving clarity. They do not alter the existing logic or functionality of the dialects.
### Checklist
This pull request is:
- [ ] A documentation / typographical / small typing error fix
- [x] A short code fix
    - _Note: This is a general cleanup refactor rather than a fix for a specific reported issue._

- [ ] A new feature implementation

**Have a nice day!**

Closes: #12534
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12534
Pull-request-sha: 2c7ae17b73192ba6bff6bec953b307a88ea31847

Change-Id: I1ec3b48f42aea7e45bc20f81add03051eb30bb98
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/postgresql/_psycopg_common.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/sqlite/provision.py