]> 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)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 24 Apr 2025 19:49:13 +0000 (21:49 +0200)
commitb10cd8607ed861dc27a789d859caec38f03440da
tree1a7e2492e5c6740d685520d78febc5b2c51700f5
parent51c12a778479b153d85f3a66c8e6ec445ceace54
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
(cherry picked from commit bb5bfb4beb35450ee8db7a173b9b438e065a90a9)
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