Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fixed list type as field result in sqlalchemy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there aren't any fixes in sqlalchemy code


## 3.3.5 ##
* Fixed use positional argument instead of named in WriterAsyncIO.__del__
* Fixed release buffer while read topic by one messages
Expand Down
9 changes: 9 additions & 0 deletions tests/sqlalchemy/test_inspect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from sqlalchemy import text

import ydb

import sqlalchemy as sa
Expand All @@ -18,3 +20,10 @@ def test_get_columns(driver_sync, sa_engine):
]

session.execute_scheme("DROP TABLE test")


def test_query_list(sa_engine):
with sa_engine.connect() as connection:
result = connection.execute(text("SELECT AsList(1, 2, 3, 4) as c"))
row = next(result)
assert row["c"] == [1, 2, 3, 4]
5 changes: 5 additions & 0 deletions ydb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def _optional_type_to_native(type_pb):
return types.OptionalType(type_to_native(type_pb.optional_type.item))


def _list_type_to_native(type_pb):
return types.ListType(type_to_native(type_pb.list_type.item))


def _primitive_type_to_native(type_pb):
return _primitive_type_by_id.get(type_pb.type_id)

Expand All @@ -240,6 +244,7 @@ def _null_type_factory(type_pb):
"type_id": _primitive_type_to_native,
"decimal_type": _decimal_type_to_native,
"null_type": _null_type_factory,
"list_type": _list_type_to_native,
}


Expand Down