Skip to main content
Dynamic tables are a powerful feature that allows you to maintain updatable lookup tables within your pipeline. Unlike static SQL transforms, dynamic tables can be modified in real-time without redeploying your pipeline. Dynamic tables work by maintaining a lookup table in a Postgres database. The lookup table can be updated in the pipeline or externally, and the pipeline can filter on the values in the lookup table using the dynamic_table_check() function. This feature can be used with a Goldsky Hosted Postgres database, or with your own Postgres database, allowing for clean compliance with GDPR and other data protection laws.

Key Features

  • Real-time Updates: Add or remove values without pipeline restart by updating a postgres table.
  • Unbounded Filters: Filter on unlimited values from onchain data or backend updates.
  • High Throughput: Sub-microsecond lookups, with dynamically batched queries for performance.
  • Pipeline Updates: Update the table with on-chain data in the same pipeline.

Use Cases

Wallet Tracking

Monitor transfers to/from specific wallet addresses

Deduplication

Track processed records to avoid duplicates

Factory Pattern

Track contracts created by a factory

Basic Configuration

Parameters

type
string
required
Must be dynamic_table
backend_type
string
required
Storage backend: Postgres
backend_entity_name
string
required
The table name in the backend storage. For Postgres, this creates a table in the streamling schema (configurable via the schema field).
secret_name
string
required
The name of a Goldsky secret containing Postgres credentials. Required for the Postgres backend.
sql
string
Optional. SQL query to automatically populate the table from pipeline data.
schema
string
Optional. PostgreSQL schema name for the table. Defaults to streamling.
column
string
Optional. Name of the primary key column storing values. Defaults to value.
time_column
string
Optional. Name of the timestamp column. Defaults to updated_at.

Backend Types

Best for production deployments requiring persistence:
Benefits:
  • Data persists across pipeline restarts and failures
  • Can be updated externally via direct SQL — no redeploy needed
  • Indexed primary-key lookups scale to millions of rows
Table Structure: PostgreSQL dynamic tables are created with two columns:
  • A primary key column (default: value) storing the lookup values
  • A timestamp column (default: updated_at) automatically set to the insertion time
Table Location: By default, tables are created in the streamling schema: streamling.tracked_contracts

Custom schema and column names

You can customize the schema, column name, and timestamp column name:
This creates a table at my_app.tracked_contracts:
Use custom schemas to organize dynamic tables by application or environment. For example, use production and staging schemas to separate data.

PostgreSQL setup

Dynamic tables with a Postgres backend need a database Goldsky can connect to and a secret with valid credentials. Use the same secret for your dynamic_table transform and any Postgres sinks in the same pipeline.
Goldsky can provision and manage a PostgreSQL database for you. This is the fastest path for dynamic tables: no IP allowlisting and no database administration on your side.Follow Goldsky-hosted Postgres on the Turbo Postgres sink page to provision a database from the web app and store the connection string as a Goldsky secret. Reference that secret in your dynamic_table transform:
You can reuse the same secret for Postgres sinks in the same pipeline. After deploy, update lookup values directly in SQL (default table location: streamling.<backend_entity_name>).

Verify the connection

After deployment, confirm the dynamic table was created:
If the pipeline fails to start, check logs for connection errors:
Common issues:
  • Connection refused or timeout: Firewall, wrong host/port, or missing IP allowlist entry (use the IP allowlisted tab if your database blocks unknown IPs).
  • Permission denied: The database role lacks CREATE on the database or USAGE/CREATE on the target schema.
  • SSL required: Add ?sslmode=require to your connection string for providers that enforce TLS.

Using Dynamic Tables in SQL

Once defined, use the dynamic_table_check() function in SQL transforms:

Function Signature

  • table_name (TEXT): The transform name of the dynamic table in your pipeline (not the backend_entity_name). Must be a string literal — the same value on every row.
  • value (TEXT): The value to check for existence.
  • Returns: true if the value exists in the table, false otherwise.
See also dynamic_table_check in SQL functions reference.

Auto-Population with SQL

You can automatically populate a dynamic table from your pipeline data:
When using SQL to populate, the query only supports projections and filters (no joins or aggregations).

Manual Updates

For Postgres backends, you can update the table directly using any Postgres client. (Substitute the schema and column names if you customized them.)
Changes take effect immediately - within seconds, your pipeline will start filtering based on the updated values!

Example: Track Specific Token Contracts

Monitor transfers for specific ERC-20 tokens like USDC:
To start tracking USDC on Polygon:
Within seconds, your pipeline will start capturing transfers for these tokens!

Example: Track Wallet Activity

Monitor all ERC-20 transfers for specific wallets:
To add a wallet to track:

Example: Complete Pipeline with Dynamic Tables

This example shows a complete pipeline that uses dynamic tables to filter ERC-20 transfers to specific contracts:
Add contracts to track: The dynamic table allows you to control which contracts to track without redeploying your pipeline.
Within seconds, your pipeline will start processing transfers for these contracts!

Example: Factory Pattern

Track all contracts created by a factory and filter events from those contracts:
This pattern automatically tracks new pools as they’re created and immediately starts capturing their swap events!

Source Validation

When a dynamic table uses SQL to auto-populate, both the dynamic table and any SQL transform using it must reference the same source or upstream transform.This ensures data consistency and proper synchronization.
Good example:
Bad example:

Performance Considerations

  • Lookups are batched and executed in parallel against Postgres (ANY(ARRAY[...]) queries).
  • The value column is PRIMARY KEY, so Postgres uses its unique index automatically.
  • Large tables (millions of entries) work fine as long as the Postgres instance has adequate resources.
  • Postgres backend: each dynamic_table_check() call queries the table directly (no in-process cache), so changes take effect on the next batch — typically within a second or two.
  • Auto-population via SQL: updates flow through with normal pipeline latency.
  • No hard row limit is enforced, but lookup cost scales with table size — keep tables as small as your use case allows.
  • Use specific filters in auto-population SQL to avoid unbounded growth.
  • For long-running pipelines, consider a cleanup strategy (DELETE old rows by updated_at).

Best Practices

1

Use Postgres for production

Always use the Postgres backend for production deployments to ensure data persistence and external updatability.
2

Use specific filters in auto-population SQL

Use specific filters in auto-population SQL to ensure data consistency and proper synchronization.
3

Lowercase string values

Store addresses and other identifiers in lowercase for consistent matching:
4

Monitor table growth

Periodically check table sizes and clean up old entries by updated_at if needed.