From be49de94ea846cf7f9c9ef406ae10631ae274b94 Mon Sep 17 00:00:00 2001 From: henrikfoss Date: Thu, 23 Jan 2025 09:31:12 +0100 Subject: [PATCH] Fix to query store columns when fetching empty result (#503) --- .../v3/datastax_astra/astra_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adapta/storage/distributed_object_store/v3/datastax_astra/astra_client.py b/adapta/storage/distributed_object_store/v3/datastax_astra/astra_client.py index 3c723fa0..b5964e73 100644 --- a/adapta/storage/distributed_object_store/v3/datastax_astra/astra_client.py +++ b/adapta/storage/distributed_object_store/v3/datastax_astra/astra_client.py @@ -64,6 +64,7 @@ from adapta.utils import chunk_list, rate_limit from adapta.utils.metaframe import MetaFrame, concat from adapta.storage.distributed_object_store.v3.datastax_astra._model_mappers import get_mapper +from adapta.schema_management.schema_entity import PythonSchemaEntity TModel = TypeVar("TModel") # pylint: disable=C0103 @@ -293,7 +294,9 @@ def to_frame( return MetaFrame( [dict(v.items()) for v in list(apply(model, key_column_filter, columns_to_select))], convert_to_polars=lambda x: polars.DataFrame(x, schema=select_columns), - convert_to_pandas=lambda x: pandas.DataFrame(x, columns=select_columns), + convert_to_pandas=lambda x: pandas.DataFrame( + x, columns=select_columns or PythonSchemaEntity(model).get_field_names() + ), ) assert (