Skip to content

Commit 52d7f18

Browse files
committed
Fix guessing type when it is already presented
1 parent 1ce95c3 commit 52d7f18

File tree

1 file changed

+6
-7
lines changed
  • ydb_sqlalchemy/sqlalchemy/compiler

1 file changed

+6
-7
lines changed

ydb_sqlalchemy/sqlalchemy/compiler/base.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,15 @@ def _is_bound_to_nullable_column(self, bind_name: str) -> bool:
317317
def _guess_bound_variable_type_by_parameters(
318318
self, bind, post_compile_bind_values: list
319319
) -> Optional[sa.types.TypeEngine]:
320-
bind_type = bind.type
321-
if bind.expanding or (isinstance(bind.type, sa.types.NullType) and post_compile_bind_values):
320+
if not isinstance(bind.type, sa.types.NullType):
321+
return bind.type
322+
323+
if post_compile_bind_values:
322324
not_null_values = [v for v in post_compile_bind_values if v is not None]
323325
if not_null_values:
324-
bind_type = _bindparam("", not_null_values[0]).type
325-
326-
if isinstance(bind_type, sa.types.NullType):
327-
return None
326+
return _bindparam("", not_null_values[0]).type
328327

329-
return bind_type
328+
return None
330329

331330
def _get_expanding_bind_names(self, bind_name: str, parameters_values: Mapping[str, List[Any]]) -> List[Any]:
332331
expanding_bind_names = []

0 commit comments

Comments
 (0)