Skip to main content
Version: 2.0.0

Publishers

A publisher function reads data from an external system and writes the data to one or more tables in the Tabsdata server.

Publisher Functions ingest data from external systems. To do so, they require a Connection that provides the credentials and configuration needed to access those systems.

Publishers in Action

Tabsdata server
collection · world
Database
PostgreSQL
PostgreSQL · external
Reachable
Connection
conn-postgres.yaml
Publisher
read_world
Table
country
//world
No versions yet
Table
city
//world
No versions yet

Publisher Code Anatomy

read_world.py
1from tabsdatak.api import publisher, TableFrameSpec
2from tabsdatak.conn.postgres import PostgresSrc
3
4
1@publisher(
2 source=PostgresSrc(
3 queries=[
8 "SELECT * FROM country",
9 "SELECT * FROM city",
10 ],
11 ),
4 output_tables=["country", "city"],
13)
56def read_world(country: TableFrameSpec, city: TableFrameSpec) -> tuple[TableFrameSpec, TableFrameSpec]:
7 return (country, city)
  • Declares what the function reads, what it writes, and which connector to use.

    • Connector class that performs the read. Address and credentials come from the collection's connection.

    • Queries to the external system, mapped positionally to function body arguments.

    • Tables that data returned by the function body is written to

  • Receives input data defined in Function decorator and writes returned data to output Tables defined in the decorator.

    • One parameter per query, in order. None when a query matched no rows.

    • One frame per output table, in order. None keeps the current version.

For step-by-step guides on building a publisher for a specific external system, see Publishers under How-to Guides.