Skip to main content

gbsync

Sync artifacts to GrowthBook using a version-controlled YAML configuration, enabling reproducible deployments and safe collaboration.

Currently supports:

  • Fact Tables
  • Fact Table Filters
  • Fact Metrics
  • Environments

Note: gbsync talks directly to the GrowthBook API, so synced resources are flagged as official and cannot be edited from the console — change YAML and re-apply.

Python 3.12+ License: MIT

Features

  • Infrastructure as Code: Define growthbook artifacts in YAML so that it can be version controlled
  • Dry-Run Planning: See what will change before applying
  • Safe Syncing: Automatic conflict detection and validation
  • External File Includes: Organize SQL in separate files

Installation

From PyPI

pip install gbsync

From Source

git clone https://github.com/growthbook/gbsync.git
cd gbsync
pip install -e .

Requirements

  • Python 3.12 or higher
  • GrowthBook account with API access
  • Supported data warehouses: Snowflake, BigQuery, PostgreSQL, MySQL, Redshift, Athena, ClickHouse, MongoDB

Quick Start

1. Get Your API Credentials

  1. Log into GrowthBook
  2. Go to Settings → API Keys
  3. Create a new API key (or copy existing)
  4. Note the API URL (e.g., https://api.growthbook.io)

2. Set Environment Variables

export GB_API_KEY="your_api_key"
export GB_API_URL="https://api.growthbook.io"

3. Create Configuration

Copy the example configuration:

cp examples/gbsync.yaml gbsync.yaml

Edit gbsync.yaml with your datasource ID, SQL, and metrics:

factTables:
  - id: fact_events
    data:
      name: Events
      datasource: ds_YOUR_DATASOURCE_ID
      userIdTypes: [user_id]
      sql: !include fact_tables/events.sql

factMetrics:
  - id: metric_conversion_rate
    data:
      name: Conversion Rate
      metricType: ratio
      numerator:
        factTableId: fact_events
        column: conversions
      denominator:
        factTableId: fact_events
        column: total_events

4. Plan Changes

See what will be created/updated/deleted:

gbsync plan

Output:

GrowthBook: Planning changes...

Tables:
  ✓ Create: Events

Metrics:
  ✓ Create: Conversion Rate

Ready to apply 2 changes

5. Apply Changes

gbsync apply

Output:

GrowthBook: Planning changes...

Tables:
  ✓ Create: Events

Metrics:
  ✓ Create: Conversion Rate

Ready to apply 2 changes
Proceed with apply? [y/N]: y

✓ Applied successfully

Commands

plan

Preview changes without applying them.

gbsync plan [OPTIONS]

Options:

  • --config, -c: Path to configuration file (default: gbsync.yaml)
  • --api-key: GrowthBook API key (or GB_API_KEY env var)
  • --api-url: GrowthBook API URL (or GB_API_URL env var)

Example:

gbsync plan --config ./metrics/prod.yaml
gbsync plan --api-key "sdk-abc123..."

apply

Apply changes to GrowthBook.

gbsync apply [OPTIONS]

Options:

  • --config, -c: Path to configuration file (default: gbsync.yaml)
  • --api-key: GrowthBook API key (or GB_API_KEY env var)
  • --api-url: GrowthBook API URL (or GB_API_URL env var)
  • --auto-approve: Skip confirmation prompt (use with caution)

Example:

gbsync apply
gbsync apply --auto-approve  # Dangerous: skips confirmation

Configuration

See examples/gbsync.yaml for an annotated reference covering projects, environments, fact tables, filters, metrics, template variables.

Metadata

Release files for gbsync 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gbsync 1.0.1
File Size Uploaded Provenance Actions
gbsync-1.0.1.tar.gz 14.4 kB Without provenance Details for gbsync-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gbsync 1.0.1
File Interpreter ABI Platform Actions
gbsync-1.0.1-py3-none-any.whl Python 3 none any Details for gbsync-1.0.1-py3-none-any.whl

Total release size: 28.4 kB

Release files / gbsync-1.0.1.tar.gz

Download URL gbsync-1.0.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ad1ea6650ed2732e554484c1729dab981b6b7170a71fae765647991ab28de84
BLAKE2b-256 checksum
How to use checksums
fa54390781af0d663dfb617706b02ec9429ea0f40995179adda838ae98c7f55a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gbsync-1.0.1-py3-none-any.whl

Download URL gbsync-1.0.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
701550b97a070c6c0460b8807fb8d3a89845a11112d51e3c6a87b6e29af84bbd
BLAKE2b-256 checksum
How to use checksums
c71fc443a6727116843d2cc9049b2eae34e331806eef6318e2f27be1c7053d70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gbsync 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page