@@ -43,8 +43,8 @@ DuckDBPyResult::~DuckDBPyResult() {
4343 }
4444}
4545
46- ClientProperties DuckDBPyResult::GetClientProperties () {
47- return result->client_properties ;
46+ shared_ptr<ClientContext> DuckDBPyResult::GetClientContext () const {
47+ return result->client_context ;
4848}
4949
5050const vector<string> &DuckDBPyResult::GetNames () {
@@ -138,7 +138,8 @@ Optional<py::tuple> DuckDBPyResult::Fetchone() {
138138 continue ;
139139 }
140140 auto val = current_chunk->data [col_idx].GetValue (chunk_offset);
141- res[col_idx] = PythonObject::FromValue (val, result->types [col_idx], result->client_properties );
141+ res[col_idx] =
142+ PythonObject::FromValue (val, result->types [col_idx], result->client_context ->GetClientProperties ());
142143 }
143144 chunk_offset++;
144145 return res;
@@ -225,8 +226,8 @@ unique_ptr<NumpyResultConversion> DuckDBPyResult::InitializeNumpyConversion(bool
225226 initial_capacity = materialized.RowCount ();
226227 }
227228
228- auto conversion =
229- make_uniq<NumpyResultConversion>(result-> types , initial_capacity, result->client_properties , pandas);
229+ auto conversion = make_uniq<NumpyResultConversion>(result-> types , initial_capacity,
230+ result->client_context -> GetClientProperties () , pandas);
230231 return conversion;
231232}
232233
@@ -297,7 +298,8 @@ void DuckDBPyResult::ConvertDateTimeTypes(PandasDataFrame &df, bool date_as_obje
297298 if (result->types [i] == LogicalType::TIMESTAMP_TZ) {
298299 // first localize to UTC then convert to timezone_config
299300 auto utc_local = df[names[i].c_str ()].attr (" dt" ).attr (" tz_localize" )(" UTC" );
300- auto new_value = utc_local.attr (" dt" ).attr (" tz_convert" )(result->client_properties .time_zone );
301+ auto new_value =
302+ utc_local.attr (" dt" ).attr (" tz_convert" )(result->client_context ->GetClientProperties ().time_zone );
301303 // We need to create the column anew because the exact dt changed to a new timezone
302304 ReplaceDFColumn (df, names[i].c_str (), i, new_value);
303305 } else if (date_as_object && result->types [i] == LogicalType::DATE) {
@@ -440,8 +442,7 @@ duckdb::pyarrow::Table DuckDBPyResult::FetchArrowTable(idx_t rows_per_batch, boo
440442 }
441443 ArrowArray data = array->arrow_array ;
442444 array->arrow_array .release = nullptr ;
443- ArrowConverter::ToArrowSchema (&arrow_schema, arrow_result.types , result_names,
444- arrow_result.client_properties );
445+ ArrowConverter::ToArrowSchema (&arrow_schema, arrow_result.types , result_names, *GetClientContext ());
445446 TransformDuckToArrowChunk (arrow_schema, data, batches);
446447 }
447448 } else {
@@ -453,9 +454,9 @@ duckdb::pyarrow::Table DuckDBPyResult::FetchArrowTable(idx_t rows_per_batch, boo
453454 {
454455 D_ASSERT (py::gil_check ());
455456 py::gil_scoped_release release;
456- count = ArrowUtil::FetchChunk (scan_state, query_result. client_properties , rows_per_batch, &data,
457- ArrowTypeExtensionData::GetExtensionTypes (
458- *query_result. client_properties . client_context , query_result. types ) );
457+ auto arrow_type_exts =
458+ ArrowTypeExtensionData::GetExtensionTypes (* GetClientContext (), query_result. types );
459+ count = ArrowUtil::FetchChunk (scan_state, * GetClientContext (), rows_per_batch, &data, arrow_type_exts );
459460 }
460461 if (count == 0 ) {
461462 break ;
@@ -465,13 +466,12 @@ duckdb::pyarrow::Table DuckDBPyResult::FetchArrowTable(idx_t rows_per_batch, boo
465466 if (to_polars) {
466467 QueryResult::DeduplicateColumns (result_names);
467468 }
468- ArrowConverter::ToArrowSchema (&arrow_schema, query_result.types , result_names,
469- query_result.client_properties );
469+ ArrowConverter::ToArrowSchema (&arrow_schema, query_result.types , result_names, *GetClientContext ());
470470 TransformDuckToArrowChunk (arrow_schema, data, batches);
471471 }
472472 }
473473
474- return pyarrow::ToArrowTable (result->types , names, std::move (batches), result-> client_properties );
474+ return pyarrow::ToArrowTable (result->types , names, std::move (batches), * GetClientContext () );
475475}
476476
477477ArrowArrayStream DuckDBPyResult::FetchArrowArrayStream (idx_t rows_per_batch) {
@@ -623,7 +623,7 @@ struct ArrowQueryResultStreamWrapper {
623623 arrays = arrow_result.ConsumeArrays ();
624624
625625 cached_schema.release = nullptr ;
626- ArrowConverter::ToArrowSchema (&cached_schema, result->types , result->names , result->client_properties );
626+ ArrowConverter::ToArrowSchema (&cached_schema, result->types , result->names , * result->client_context );
627627
628628 stream.private_data = this ;
629629 stream.get_schema = GetSchema;
0 commit comments