Skip to content

UInt64 values incorrectly inferred as Int64 in SQLAlchemy parameter binding #83

@krasnovdm

Description

@krasnovdm

Root Cause

The YDB SQLAlchemy driver incorrectly infers parameter types, treating UInt64 values as Int64
Problem occurs in the type handling logic of BaseYqlCompiler when processing expanding parameters (IN clauses)
Naked queries work fine in YDB, confirming this is a driver-level issue

Workarounds

query = select(table.c.id).where(
    table.c.id.in_(bindparam("ids", type_=ydb_sa_types.ListType(ydb_sa_types.Uint64)))
)
session.execute(query, {"ids": [16140901099660902405]})

looks the problem from here https://github.com/ydb-platform/ydb-sqlalchemy/blob/0.1.8/ydb_sqlalchemy/sqlalchemy/compiler/base.py#L317

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions