Skip to content

Commit bd6da38

Browse files
authored
cancel call GET /rows/:row_id/ API (#886)
1 parent 42f7089 commit bd6da38

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

dtable_events/automations/general_actions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,15 @@ def get_converted_row(self, table_id, row_id):
244244
if not table:
245245
logger.error('dtable: %s table: %s not found', self.dtable_uuid, table_id)
246246
return None
247+
sql = f"SELECT * FROM `{table['name']}` WHERE _id='{row_id}'"
247248
try:
248-
converted_row = self.dtable_server_api.get_row(table['name'], row_id, convert_link_id=True)
249-
if not converted_row:
250-
logger.error('dtable: %s table: %s row: %s not found or parse error', self.dtable_uuid, table_id, row_id)
251-
return None
249+
rows = self.dtable_db_api.query(sql, convert=True, server_only=True)[0]
252250
except Exception as e:
253251
logger.error('dtable: %s table: %s row: %s error: %s', self.dtable_uuid, table_id, row_id, e)
254252
return None
253+
if not rows:
254+
return None
255+
converted_row = rows[0]
255256
return converted_row
256257

257258
def get_sql_row(self, table_id, row_id):

dtable_events/dtable_io/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from seaserv import seafile_api
1515

16-
from dtable_events.app.config import DTABLE_WEB_SERVICE_URL, INNER_DTABLE_SERVER_URL
16+
from dtable_events.app.config import DTABLE_WEB_SERVICE_URL, INNER_DTABLE_SERVER_URL, INNER_DTABLE_DB_URL
1717
from dtable_events.dtable_io.big_data import import_excel_to_db, update_excel_to_db, export_big_data_to_excel, \
1818
export_app_table_page_to_excel
1919
from dtable_events.dtable_io.utils import import_archive_from_src_dtable, post_big_data_screen_app_zip_file, \
@@ -36,6 +36,7 @@
3636
from dtable_events.statistics.db import save_email_sending_records, batch_save_email_sending_records
3737
from dtable_events.data_sync.data_sync_utils import run_sync_emails
3838
from dtable_events.utils import is_valid_email, uuid_str_to_36_chars, gen_file_upload_url, uuid_str_to_32_chars
39+
from dtable_events.utils.dtable_db_api import DTableDBAPI
3940
from dtable_events.utils.dtable_server_api import DTableServerAPI, BaseExceedsException
4041
from dtable_events.utils.dtable_web_api import DTableWebAPI
4142
from dtable_events.utils.exception import ExcelFormatError
@@ -861,7 +862,12 @@ def send_notification_msg(emails, user_col_key, msg, dtable_uuid, username, tabl
861862
if not table:
862863
return
863864

864-
target_row = dtable_server_api.get_row(table['name'], row_id)
865+
sql = f"SELECT * FROM `{table['name']}` WHERE _id='{row_id}'"
866+
dtable_db_api = DTableDBAPI(username, dtable_uuid, INNER_DTABLE_DB_URL)
867+
rows = dtable_db_api.query(sql, convert=True, server_only=True)[0]
868+
if not rows:
869+
return
870+
target_row = rows[0]
865871

866872
sending_list = emails
867873
if user_col_key:
@@ -1173,7 +1179,12 @@ def plugin_email_send_email(context):
11731179
dtable_server_api = DTableServerAPI(username, dtable_uuid, INNER_DTABLE_SERVER_URL, dtable_web_service_url=DTABLE_WEB_SERVICE_URL,
11741180
repo_id=repo_id, workspace_id=workspace_id)
11751181

1176-
replied_email_row = dtable_server_api.get_row(email_table_name, email_row_id)
1182+
sql = f"SELECT * FROM `{email_table_name}` WHERE _id='{email_row_id}'"
1183+
dtable_db_api = DTableDBAPI(username, dtable_uuid, INNER_DTABLE_DB_URL)
1184+
rows = dtable_db_api.query(sql, convert=True, server_only=True)[0]
1185+
if not rows:
1186+
return
1187+
replied_email_row = rows[0]
11771188

11781189
thread_id = replied_email_row.get('Thread ID')
11791190

0 commit comments

Comments
 (0)