Skip to content

Fix SQLAlchemy 2.0 FOR UPDATE AttributeError and reserved word quoting - #200

Open
bchoudhary6415 wants to merge 1 commit into
ibmdb:masterfrom
bchoudhary6415:ibmdbsa_hcadwork
Open

bchoudhary6415 wants to merge 1 commit into
ibmdb:masterfrom
bchoudhary6415:ibmdbsa_hcadwork

Conversation

@bchoudhary6415

Copy link
Copy Markdown
Collaborator

Resolves two issues in ibm_db_sa:

  1. FOR UPDATE AttributeError on SQLAlchemy 2.0.x

    • for_update_clause() used the removed select.for_update attribute,
      raising "'Select' object has no attribute 'for_update'".
    • Rewrote it to be version-agnostic (SQLAlchemy 0.7.3 -> 2.0.x):
      modern versions use select._for_update_arg, legacy versions fall
      back to select.for_update.
    • Pinned sqlalchemy>=1.3.5,<2.1 in setup.py to stay within the
      supported range.
  2. Reserved word quoting

    • Added 'role' to RESERVED_WORDS.
    • Added a safe quote_identifier() override that uppercases only
      case-insensitive (lowercase) normalized identifiers to match Db2's
      catalog, while preserving explicitly quoted (quote=True) and
      mixed-case identifiers so case-sensitive schema/table/column names
      still resolve correctly.

Signed-off-by: Balram Choudhary <bchoudhary@rocketsoftware.com>
@bchoudhary6415 bchoudhary6415 self-assigned this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant