Python and SQL dtable_db

Setup:

  • SeaTable Edition ( Enterprise)
  • SeaTable Version (5.3.12):

In Seatable script runner I would like to use SQL queries to manage update 60k rows faster. Now I use base.list_rows and base.update_row but it is very slow. Tried to import dtable_db but it seems it is not available. is it not included automatically in latest installation? - As I understand, updates should then work also in BIG Data? Pls any suggestion for managing/updating so huge amount of rows, and 2. to update also BIG Data.

The base.query() method is much better than the list_rows() method. Please use the former to query data. (For updating data, you can use update_row() or query().)

Did you update the Python pipeline? If not, please do. It is possible that you are running a very old version with an outdated Python client.

we are running the latest self-hosted SeaTable server and have just updated both the backend and the Python pipeline.
Our seatable-api version is 3.1.0 (Python client), and the API Gateway is running.
However, we are still unable to use the base.query() method as described in the documentation and by your support team.
For example, when running the following code in our script environment:

from seatable_api import Base
api_token = ‘MY_TOKEN’
server_url = ‘MY_URL’

base = Base(api_token, server_url)
base.auth()

rows = base.query(‘Table1’, {‘Auto number’: ‘CN-000001’})
print(rows)

we consistently get this error: ConnectionError: [Errno 400] {“error_message”:“parse error: unexpected identifier near {}”}

We have confirmed:

  • The Python package seatable-api is up-to-date (3.1.0).
  • The API token is valid (other calls, e.g., list_rows, work).
  • The backend, gateway, and all services are running and have been restarted.
  • Other SeaTable API functions work as expected.

Questions:

  1. Is there any further configuration required on the API Gateway or backend to enable filtering via base.query() on self-hosted instances?
  2. Are there any known issues with base.query() returning this error even on up-to-date self-hosted SeaTable and seatable-api 3.1.0?
  3. Is there a recommended way to troubleshoot or debug this "parse error: unexpected identifier near {}"?

Please try:

from seatable_api import Base
api_token = ‘MY_TOKEN’
server_url = ‘MY_URL’

base = Base(api_token, server_url)
base.auth()

rows = base.query("SELECT * FROM Table1 WHERE `Auto number` = 'CN-000001' "
print(rows)

The base.query() method expects an SQL statement as parameter. For more info, please see Rows - SeaTable Developer Manual

Thank you, it works great :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.