Tutorial: Get your complete table and base structure - to help them, who support you

Hey everybody,

I think most of you know this problem: you have a base, and you want to ask something. But to explain what you would like to achieve in SeaTable, it is necessary to explain the current structure of your base. Of course, you could make screenshots or describe how your base looks like, but … well, that is time-consuming.

Now there is a better way to do this. Here is a small python script. Just create a new python-script inside your base, copy the following code to it and execute it. The script will give you your complete base structure that you then can post to this forum.

Here is the code:

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+")")

And the result will look like this:

--- 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)

Just paste this code to your next topic you create here on the forum, and you will help everybody to understand how your base looks like.

By the way, here is the entry in our user manual:

4 Likes