Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "upsolver-sdk-python"
version = "0.1.7"
version = "0.1.8"
description = "Python SDK for Upsolver"
authors = ["Upsolver Team <[email protected]>"]

Expand Down
11 changes: 8 additions & 3 deletions upsolver/client/poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,14 @@ def extract_json() -> dict:

if 'result' in rjson:
result = rjson['result']
grid = result['grid'] # columns, data, ...
column_names = [c['name'] for c in grid['columns']]
data_w_columns: ExecutionResult = [dict(zip(column_names, row)) for row in grid['data']]
if rjson['kind'] == 'upsolver_scalar_query_response':
scalar = result['scalar']
column_name = [scalar['valueType']]
data_w_columns: ExecutionResult = [dict(zip([column_name], [scalar]))]
else:
grid = result['grid'] # columns, data, ...
column_name = [c['name'] for c in grid['columns']]
data_w_columns: ExecutionResult = [dict(zip(column_name, row)) for row in grid['data']]

return data_w_columns, result.get('next')
else:
Expand Down
6 changes: 6 additions & 0 deletions upsolver/dbapi/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@
except BaseException as e:
print('Caught error on closed connection')
# %%
job_name = '' # Job name here
print('Execute a `SHOW CREATE` statement:')
result1 = cursor.execute(f'show create job {job_name};')
print('create job statement:')
result2 = cursor.fetchone()
print(result2)
9 changes: 7 additions & 2 deletions upsolver/dbapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def extract_json() -> dict:

if 'result' in rjson:
result = rjson['result']
result['grid']['has_next_page'] = result.get('next') is not None
return result['grid'], result.get('next')
if rjson['kind'] == 'upsolver_scalar_query_response':
scalar = result['scalar']
columns = [{'name': scalar['valueType'], 'columnType': {'clazz': 'StringColumnType'}}]
return {'columns': columns, 'data': [scalar]}, result.get('next')
else:
result['grid']['has_next_page'] = result.get('next') is not None
return result['grid'], result.get('next')
else:
return rjson, None