Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Double-onboard a data source

Publish a contract from Soda Core, then connect the data source to a Soda Runner in Soda Cloud to use Metric Monitoring, Profiling, and contract verification on the runner.

A data source reaches Soda Cloud in one of two ways. When you publish a contract or verification results from Soda Core, Soda Cloud creates the data source and the dataset for you, but does not connect the data source to a Soda Runner. When you add a data source in Soda Cloud, you connect it through a runner.

This guide does both for the same data source. A team starts with Soda Core, verifying contracts from the command line with a local configuration file. Later, they connect the same data source to a runner in Soda Cloud. The runner unlocks the features that run in Soda Cloud:

  • Metric Monitoring

  • Profiling

  • Running contracts on the runner, from the Soda Cloud interface or on a schedule

Soda Core keeps working as before: the team can go on verifying contracts locally and publishing the results.

The examples use a PostgreSQL data source and its fact_internet_sales table.

Prerequisites

  • Python 3.10, 3.11, or 3.12, and a read-only user for the PostgreSQL database.

  • A Soda Cloud account and an API key. See Generate API keys.

  • To publish a contract for a new data source, the global permission Create new datasets and data sources with Core/Library. To connect the data source to a runner, permission to manage the data source's settings. See Global and dataset roles.

  • A runner that can reach the database: the Soda-hosted runner, or a self-hosted runner in your own environment. To use the Soda-hosted runner, allow its IP address in your network. See Deployment options.

Install Soda Core

Install the Soda Core package for PostgreSQL:

pip install -i https://pypi.cloud.soda.io/simple "soda-postgres>4"

For other data sources and the private PyPI, see Soda Python libraries.

Connect Soda Core

Create a data source configuration file. The name becomes the name of the data source in Soda Cloud. The values in ${env.…} are read from environment variables.

Create a Soda Cloud configuration file. Use cloud.us.soda.io or cloud.soda.io, depending on your Soda region.

Test both connections:

For every connection parameter, see PostgreSQL.

Publish a contract from Soda Core

Write a contract for the table. Its dataset starts with the data source name from ds_config.yml, followed by the database, the schema, and the table.

Check that the contract is valid, then verify it and publish the contract and its results to Soda Cloud:

Soda Core runs the checks locally and sends the results to Soda Cloud, which creates the data source and the dataset. The data source has no connection details in Soda Cloud and no runner, so the features that need a runner are not available yet. On the dataset's Metric Monitors tab, Soda Cloud explains that the metric monitoring dashboard is only compatible with data sources connected through a Soda Runner.

The Metric Monitors tab of fact_internet_sales, with a message that the data source is connected to Soda Cloud via Soda Library and needs a Soda Runner
A dataset published from Soda Core, before the data source has a runner

For more on this flow, see Onboard a data source via Soda Core.

Connect the data source to a runner

To complete the onboarding, give the data source a runner and connection details in Soda Cloud.

1

Open the connection

In Soda Cloud, go to Data Sources. In the row of the data source that Soda Core created, click â‹® > Edit Connection.

The Data Sources page with the row menu of the data source open, showing Edit Connection
The data source's row menu
2

Select a runner

The Edit Connection panel keeps the data source's name and owner. Under Default Runner, select the runner that connects to the data source in Default Scan Runner.

The Edit Connection panel with the Default Scan Runner list open, showing the Soda-hosted runner
Select the runner
3

Enter the connection details

Under Connection Details, fill in the same connection details that Soda Core uses: the host, port, user, password, and database.

For the password, use a Soda secret: click Secret next to the field. In the Secrets dialog, click Use next to an existing secret, or enter a Name and a Value and click Create & Use. Soda Cloud stores secrets encrypted, so the password does not appear in plain text in the connection configuration.

The Connection Details section of the Edit Connection panel, with Host, Port, User, Password, and Database fields, each with a Secret button
Connection details
4

Test and save

Click Test connection. When the test passes, click Save.

The data source keeps its name, so the contract, the dataset, and the check results that Soda Core published stay where they are. After you save, Soda runs a discovery scan on the runner to list the datasets in the data source. On the Data Sources page, Onboard Datasets is now available for the data source, to onboard the other datasets that discovery found.

On the dataset's Metric Monitors tab, the message about Soda Library is gone. Click Update Metric Monitoring Configuration to turn on Metric Monitoring for the dataset.

The Metric Monitors tab of fact_internet_sales after the data source is connected to a runner, with the button Update Metric Monitoring Configuration
Metric Monitoring is available once the data source has a runner

For every field of the connection form, see Onboard datasets on Soda Cloud.

Verify the contract on the runner

The runner can now verify the published contract. From the command line, add --use-runner and name the dataset instead of the contract file. The command needs only the Soda Cloud configuration, because the runner holds the connection details. Add --publish to record the results on the dataset; without it, the runner runs the contract as a test.

The results appear on the dataset's Checks tab and its Scans tab, next to the results Soda Core published. To verify the contract from Soda Cloud instead, click Verify all checks on the Checks tab.

The Checks tab of fact_internet_sales, with the five checks of the contract passing
Contract results of fact_internet_sales

To verify a contract from the dataset page or on a schedule, see Verify a contract.

Next steps

Last updated

Was this helpful?