Base not found in sql

Hello, I think I have a bug

because by using the sql function of the api i can easily access my data and without changing anything in the sql code when i execute the code it tells me that it can’t find the database even though it exists and the id hasn’t changed. do you know why and how i can fix it :sweat_smile: ?

Did you hit the API limits? See here: System Limitations - SeaTable Admin Manual

no i didnt hit the API limits i only do 2 requests :sweat_smile:
but here is my error message if you want : {‘success’: False, ‘error_message’: ‘base a30fc064-b377-44df-9931-adb2b0f95d28 not found’, ‘results’: [], ‘metadata’: []}

I’m probably repeating myself but when I make a query that only looks at or modifies an existing line it works

and here is my sql in case : INSERT INTO server VALUES (“test”, “test”, “test”, “test”)

can someone help me :sweat_smile:

please can someone help me i need to use this :frowning:

Your SQL-Insert command uses the wrong syntax: You have to name all the target columns, and therefore it should be:

INSERT INTO table_name [column_list] VALUES value_list [, ...]

Here is the documentation about this:
https://seatable.github.io/seatable-scripts/python/sql/

Please try this new insert statement and if this is not working, please give more details:

  • which programming language do you use?
  • what does your complete script look like?
  • how is the structure of your base?

Best regards
Christoph

1 Like

Hi
English is not my first language and I am not very good at it :sweat_smile:
and translators are unfortunately not very good at translating documentation.

Since I would like to learn, could you give me an example and if possible explain me a little :sweat_smile:

Thank you :pray:

You tried:

INSERT INTO server VALUES (“test”, “test”, “test”, “test”)

but it has to be:

INSERT INTO server (name_of_column1, name_of_column2, ...) VALUES (“test”, “test”, “test”, “test”)

Thanks a lot,

but trying to use this I still got the same error message:

{ 'success': False, 'error_message': 'base a30fc064-b377-44df-9931-adb2b0f95d28 not found', 'results': [], 'metadata': []}

and as you asked me here is my code :

import requests
import json

url = "https://cloud.seatable.io/dtable-db/api/v1/query/a30fc064-b377-44df-9931-adb2b0f95d28/"

payload = json.dumps({
  "sql": 'INSERT INTO server (ServerId, Prefix, Language, CommandActive, CommandDesactive) VALUES ("test", "test", "test", "test")',
  "convert_keys: True
})
headers = {
  'Authorization': 'Token hereismytoken',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

response = response.json()

print(response)

I have this same error. When I use the exact same base and token with a SELECT query it works fine. However, when I try the INSERT query, I get this error
( I have removed the base uuid):


[
{
"success":
false,
"error_message":
"base base_uuid not found",
"results":
[
],
"metadata":
[
]
}
]