Skip to content

Commit

Permalink
Add raw data return from idr_query()
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPratten committed Jan 11, 2023
1 parent ef7234e commit e6e2e45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jetisu/idr_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e6e2e45

Please sign in to comment.