Skip to content

Commit 2e75909

Browse files
authored
convert rows by passing convert_keys to api-gateway instead of converting in python (#115)
1 parent 769cf47 commit 2e75909

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

seatable_api/api_gateway.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import requests
22

33
from .constants import ROW_FILTER_KEYS, ColumnTypes
4-
from .constants import RENAME_COLUMN, RESIZE_COLUMN, FREEZE_COLUMN, MOVE_COLUMN, MODIFY_COLUMN_TYPE, DELETE_COLUMN
5-
from .utils import convert_db_rows, parse_response, like_table_id, parse_headers
4+
from .constants import RENAME_COLUMN, RESIZE_COLUMN, FREEZE_COLUMN, MOVE_COLUMN, MODIFY_COLUMN_TYPE
5+
from .utils import parse_response, like_table_id
66

77

88
class APIGateway(object):
@@ -809,17 +809,14 @@ def query(self, sql, convert=True, parameters=None):
809809
json_data = {'sql': sql}
810810
if parameters:
811811
json_data['parameters'] = parameters
812+
if convert:
813+
json_data['convert_keys'] = True
812814
response = requests.post(url, json=json_data, headers=self.headers, timeout=self.timeout)
813815
data = parse_response(response)
814816
if not data.get('success'):
815817
raise Exception(data.get('error_message'))
816-
metadata = data.get('metadata')
817818
results = data.get('results')
818-
if convert:
819-
converted_results = convert_db_rows(metadata, results)
820-
return converted_results
821-
else:
822-
return results
819+
return results
823820

824821
def send_toast_notification(self, username, msg, toast_type='success'):
825822
url = self._send_toast_notification_url()

0 commit comments

Comments
 (0)