Skip to main content

Getting Started with Data Quality as Code

This guide will help you install the Collate Python SDK and configure authentication to start running data quality tests programmatically.

Prerequisites

Before you begin, ensure you have:
  • Python 3.10 or higher installed
  • pip package manager
  • Access to an Collate instance (version 1.11.0 or later)
  • A JWT token for authentication (see Authentication below)

Installation

Install the openmetadata-ingestion package with the necessary extras for your use case:

Basic Installation

Installation with Database Connectors

Install additional dependencies based on the databases you’ll be testing:

Installation with DataFrame Support

If you plan to use DataFrame validation features:

Installation with Multiple Features

Combine multiple extras as needed:

Authentication

Data Quality as Code requires authentication with your Collate instance. The SDK supports JWT token authentication.

Getting a JWT Token

Obtain a JWT token in one of two ways:
Note: The Bots tile under Settings is only visible to users with Admin privileges. If you don’t see it, ask your organization’s Collate Admin to generate a bot token for you or grant you Admin access.

Option 1: Using an Existing Bot Token

Collate provides pre-configured bots like the ingestion-bot:
  1. Log in to Collate platform.
  2. Click the Profile icon and navigate to Settings > Bots.
  3. Find and click the ingestion-bot.
  4. Copy and save the JWT token for later use. JWT Token

Option 2: Creating a Custom Bot

For production use, create a dedicated bot with specific permissions:
  1. Log in to Collate platform.
  2. Click the Profile icon and navigate to Settings > Bots.
  3. Click Add Bot and fill in the following fields:
    • Email (required): Enter the bot’s email address.
    • Display Name: Enter a display name for the bot.
    • Token Expiration (required): Select how long the JWT token should remain valid.
    • Allow Impersonation: Leave this off unless the bot needs to act on behalf of users. This setting can only be changed at creation time.
    • Description: Optionally add a description for the bot.
  4. Click Create and slect the bot you created from the list.
  5. Assign appropriate roles (typically DefaultBotPolicy and Ingestion Bot Policy). Edit Bot Roles
  6. Copy and save the generated JWT token.

Configuring the SDK

Once you have a JWT token, configure the SDK in your Python code:

Using Environment Variables

For better security, let configure pick them up from environment variables:
Set the environment variable before running your script:

Configuration Parameters

The configure() function accepts the following parameters:

Verify Installation

Create a simple test to verify your setup:
Replace "your_service.database.schema.table" with the fully qualified name of an actual table in your Collate instance.

Your First Data Quality Test

Now that you’re set up, let’s run your first data quality test:

Common Installation Issues

Connection Timeout

If you experience connection timeouts, verify:
  1. Collate instance is running and accessible
  2. API URL is correct (should end with /api)
  3. Network connectivity between your script and Collate
  4. Firewall rules allow the connection

Import Errors

If you encounter import errors:
Verify the package is installed correctly:
If not listed, reinstall:

Next Steps

Now that you have the SDK installed and configured:

Additional Resources