Table of Contents
In the following article you will find a Python script that allows you to output the entire table and column structure of a base as plain text. This structure helps for example the user support to understand when you ask a question in the forum.
Entering and executing the script
- Open the Base in which you have a problem.
- Click in the Base header.
- Create a new script and select Python.
- Copy the following code to the left pane.
from seatable_api import Base, context
server_url = context.server_url
api_token = context.api_token
base = Base(api_token, server_url)
base.auth()
metadata = base.get_metadata()
print("--- COMPLETE BASE STRUCTURE WITH ALL BASES AND COLUMNS ---")
for table in metadata['tables']:
print('.')
print("Table: "+table['name']+" (ID: "+table['_id']+")")
for column in table['columns']:
link_target = ""
if column['type'] == "link":
link_target = " --> "+column['data']['other_table_id']
if column['data']['other_table_id'] == table['_id']:
link_target = " --> "+column['data']['table_id']
print(" --> "+column['name']+" ("+column['type']+link_target+")")
- Confirm with Run script.
The result of the Python script
For example, the output of the script returns the following result, which you can then copy and use for a Forum entry or for a Support ticket can use
--- COMPLETE BASE STRUCTURE WITH ALL BASES AND COLUMNS ---
.
Table: inventory (ID: 0000)
--> Name (text)
--> Link to other table (link --> 5H74)
--> Status (single-select)
--> Collaborator (collaborator)
--> URL of the customer (url)
.
Table: price range (ID: 5H74)
--> Name (text)
--> Min Price (number)
--> Max Price (number)
--> inventory (link --> 0000)
Use the base structure for an entry in the community forum
If you open a new topic in the SeaTable forum using the + New Topic button, you can insert your base structure as preformatted text to illustrate the problem.