Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tabsdata

TabsData Examples Guide

Welcome to the TabsData Examples Guide!

This guide provides an overview of how to explore and run the TabsData examples that come bundled when you install tabsdata on your local machine.

These examples are designed to help you get started quickly and understand how to work with publishers, subscribers, and transformers across a variety of input/output backends. Some examples also demonstrate more advanced setups, such as chained triggers and multi-stage data flows.

How to Generate the Examples

You can generate a local copy of the examples suite by running the following command:

td examples --dir=<path>

This will create a new directory at the location you specify, populated with all the available example use cases. The folder must not already exist as it will be created by the CLI.

Here, <path> should be replaced with the target directory where you want the examples to be created.

How to Open This Guide

To automatically open this guide in your browser after generating the examples, simply append the --guide flag:

td examples --dir=<path> --guide

This is particularly useful if you are generating the examples for the first time and want to immediately start exploring them with the help of this documentation.

Examples

This section contains practical examples demonstrating how to use Tabsdata.

Browse through the examples below to learn different aspects of working with Tabsdata.

Tabsdata

Walkthrough Example

Setting Up the Environment to Run the Example

Before beginning this tutorial, open your terminal in the 1-walkthrough subfolder located within the examples directory you generated using the td examples command.

Make sure you are working within an active Python environment, either virtual or system-level, that has the tabsdata package installed.

For this example to work out of the box, both the tdserver and td commands must be run on the same host.

Stop the Tabsdata Server and Check Its Status

Note: This helps to ensure that you run the tutorial in a fully functioning tabsdata server.

tdserver stop
tdserver status

Start the Tabsdata Server and Check Its Status

tdserver start
tdserver status

Log In

td login --server localhost --user admin --password tabsdata --role sys_admin

Create a Collection

td collection create --name examples --description "Examples"

Note: You may want to use a different name for your collection, especially if you run this tutorial more than once.

Create and Test the Publisher

Register the Publisher

td fn register --coll examples --path publisher.py::pub

Trigger the Publisher

td fn trigger --coll examples --name pub

Show the Schema of the Table Populated by the Publisher

td table schema --coll examples --name persons

Create and Test the Transformer

Register the Transformer

td fn register --coll examples --path transformer.py::tfr

Trigger the Transformer

td fn trigger --coll examples --name tfr

Show the Schema of a Table Populated by the Transformer

td table schema --coll examples --name spanish

Create and Test the Subscriber

Register the Subscriber

td fn register --coll examples --path subscriber.py::sub

Trigger the Subscriber

td fn trigger --coll examples --name sub

Inspect the Files Exported by the Subscriber

For Linux/macOS

ls output/*

For Windows

dir output\*

Trigger the Execution of the Publisher, Transformer and Subscriber

Delete the Output Files

For Linux/macOS

rm output/*

For Windows

del output\*

Trigger the Publisher

Once the Publisher, Transformer and Subscriber are registered, triggering the Publisher will automatically trigger the other two in sequence (i.e., execute the entire trigger graph).

td fn trigger --coll examples --name pub

Inspect the Files Exported by the Subscriber

For Linux/macOS

ls output/*

For Windows

dir output\*