Skip to content

Python Pipeline

To run Python scripts within SeaTable, you need to install the Python Pipeline — an environment utilizing Docker containers for script execution and result retrieval. Thanks to the SeaTable Python API you can seamlessly interact with the data in the base.

Explore various use cases from other SeaTable users:

  • Retrieve current stock prices and store them in SeaTable.
  • Validate DNS settings of specified domains for specific TXT entries.
  • Capture submissions from form.io and store the results.
  • Identify duplicate entries and apply specific tags.

Find additional Python functions and code examples in the Developer Manual.

SeaTable Python Pipeline Page

Installation

This article explains how to add the Python Pipeline on your SeaTable server.

Change the .env file

To install the Python Pipeline, include python-pipeline.yml in the COMPOSE_FILE variable within your .env file. This instructs Docker to download the required images for the Python Pipeline.

Simply copy and paste () the following code into your command line:

sed -i "s/COMPOSE_FILE='\(.*\)'/COMPOSE_FILE='\1,python-pipeline.yml'/" /opt/seatable-compose/.env

Avoid space in COMPOSE_FILE

When manually adding python-pipeline.yml to the COMPOSE_FILE variable using your preferred editor, ensure that you avoid any space (). After making this modification, your COMPOSE_FILE variable should look like this:

COMPOSE_FILE='caddy.yml,seatable-server.yml,python-pipeline.yml'

Generate a shared secret for secure communication

For secure communication between SeaTable and the Python Pipeline, a shared secret is required to prevent unauthorized access or usage. We recommend utilizing pwgen to generate a robust and secure password. Copy and paste the following command into your command line to generate a password:

pw=$(pwgen -s 40 1) && echo "Generated shared secret: ${pw}"

Update the configuration

The generated shared secret needs to be added to both your .env file and the configuration files of your SeaTable Server.

Copy and paste the following commands to include the shared secret in the .env file:

echo -e "\n# python-pipeline" >> /opt/seatable-compose/.env
echo "PYTHON_SCHEDULER_AUTH_TOKEN=${pw}" >> /opt/seatable-compose/.env

Now execute this command to add the required configuration to dtable_web_settings.py:

echo -e "\n# python-pipeline" >> /opt/seatable-server/seatable/conf/dtable_web_settings.py
echo "SEATABLE_FAAS_URL = 'http://python-scheduler'" >> /opt/seatable-server/seatable/conf/dtable_web_settings.py
echo "SEATABLE_FAAS_AUTH_TOKEN = '${pw}'" >> /opt/seatable-server/seatable/conf/dtable_web_settings.py

Start the Python Pipeline

Now it is time to start the Python Pipeline.

cd /opt/seatable-compose && \
docker compose up -d && \
docker exec -d seatable-server /shared/seatable/scripts/seatable.sh restart

Check if the Python Pipeline is running

Do you want to execute your first python script in SeaTable? Nothing easier than that.

  • Login to your SeaTable Server with your Browser.
  • Create a new base and access it.
  • Add a python script with the content print("Hello World") and execute it. If you don't know how to do this, check out our user manual.

If everything went right, you should see the output Hello World.

Execution of your first python script

Great! Your SeaTable can execute Python scripts now.