From e6e2e45e6b2f6d83a1950626fc952a5abb01fc34 Mon Sep 17 00:00:00 2001 From: David Pratten Date: Wed, 11 Jan 2023 11:35:51 +1100 Subject: [PATCH] Add raw data return from idr_query() --- jetisu/idr_query.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jetisu/idr_query.py b/jetisu/idr_query.py index af22de5..a5cf23f 100644 --- a/jetisu/idr_query.py +++ b/jetisu/idr_query.py @@ -39,7 +39,7 @@ def mzn_output_quote(k, v, typed_parameters_dict): return v def idr_query(sql_query, return_data): - assert return_data in ['data', 'markdown table', 'model', 'constrained model'] + assert return_data in ['raw', 'data', 'markdown table', 'model', 'constrained model'] # handles a conjuction of simple constraint clauses only TODO Generalise this code. table_name = '' @@ -216,8 +216,9 @@ def idr_query(sql_query, return_data): schema=schema, tables=table_input ) - - if return_data == 'data': + if return_data == 'raw': + return res + elif return_data == 'data': return res.columns, res.rows elif return_data == 'markdown table': return '|' + '|'.join(res.columns) + '|' + "\n" + '|' + '|'.join(