From 2421f25d6a988b2a9784555f5cd129e943612fbc Mon Sep 17 00:00:00 2001 From: ds_93 Date: Wed, 14 Aug 2024 15:45:20 +0200 Subject: [PATCH] BUG: fixed sql_query function to work with multiple indices --- idc_index/index.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/idc_index/index.py b/idc_index/index.py index 1ec55233..379c953d 100644 --- a/idc_index/index.py +++ b/idc_index/index.py @@ -1679,4 +1679,11 @@ def sql_query(self, sql_query): """ index = self.index + # TODO: find a more elegant way to automate the following: https://www.perplexity.ai/search/write-python-code-that-iterate-XY9ppywbQFSRnOpgbwx_uQ + if hasattr(self, "sm_index"): + sm_index = self.sm_index + if hasattr(self, "sm_instance_index"): + sm_instance_index = self.sm_instance_index + if hasattr(self, "clinical_index"): + clinical_index = self.clinical_index return duckdb.query(sql_query).to_df()