Skip to main content

dagctl

The command-line client for dagctl, a hosted platform that runs SQLMesh and dbt projects in production. dagctl keeps your project's SQLMesh state, runs your models on a schedule, holds deployments for approval on the environments you protect, and alerts you in Slack when something breaks. When a run fails, its remediation agent diagnoses the problem and opens a pull request with a fix. Your project stays a standard open-source SQLMesh project.

This package is for SQLMesh projects. It signs you in to your dagctl organization and hands SQLMesh a connection to your project's hosted state, so sqlmesh plan and sqlmesh run on a laptop see the same state as production. There is nothing to run locally and no state-database credentials to manage.

What it does

  • Signs you in to a dagctl organization from the browser and keeps the session fresh.
  • Sets which project you are working in.
  • Gives SQLMesh the state connection for that project through get_state_connection(), so your config.py carries no state-database credentials.
  • Converts an existing config.yaml into a config.py wired to dagctl.

Requirements

  • Python 3.9 or newer
  • A dagctl organization. If you do not have one, start a 14-day free trial at https://dagctl.io.

Installation

pip install dagctl

Quick start

# 1. Sign in to your organization
dagctl auth login --org your-org

# 2. Choose the project you are working in
dagctl use-project my-project

# 3. Point SQLMesh at dagctl (converts config.yaml to config.py)
cd my-sqlmesh-project
dagctl config generate

# 4. Use SQLMesh as usual
sqlmesh plan

dagctl config generate needs a config.yaml (or config.yml) in the project directory. It writes config.py and keeps the original with a .bak suffix. Use dagctl auth status and dagctl config current to see who you are signed in as and which project is selected.

The dagctl platform

  • Semantic layer for agents: expose a SQLMesh project's models and definitions as an MCP server. Your analysts point Claude or any MCP client at it and query governed data through dagctl, without warehouse credentials of their own.
  • Automatic fixes: when a run fails, dagctl diagnoses it and opens a pull request with a proposed fix.
  • Change control: plan review and approval on the environments you protect. Approval on a protected environment is limited to the named users, API tokens, or roles you list.
  • Scheduling and state: hosted SQLMesh state, scheduled runs, run history, and logs.
  • Alerts: plan and run alerts to Slack.
  • Enterprise access control: single sign-on over SAML or OIDC through your identity provider, on the Team plan and above, configured for you by our team. Users who sign in through your SSO connection are added to your organization automatically with the Reader role. Owner, Admin, Developer, Reader, and Analyst roles and API tokens are on every plan. Owners and admins can view an audit log of configuration changes (protections, members, tokens, variables, and integrations).
  • dbt: dbt projects run on the same platform and are managed from the web app. This CLI is for SQLMesh.
  • Set up from your AI assistant: connect Claude or any MCP client to dagctl and go from sign-up to a first run without leaving the chat.
  • Pricing: one flat monthly price per organization, set by how many models you run. Every user and every run is included. Self-serve plans start with a 14-day free trial, no credit card required. Current plans and prices: https://dagctl.io/#pricing.

How it works

SQLMesh keeps track of what has run and what changed in a state database. dagctl hosts that database for your project. When SQLMesh starts, it calls get_state_connection() from this package, which:

  1. Reads your sign-in from ~/.dagctl/
  2. Refreshes the session if it has expired
  3. Returns the connection details SQLMesh expects

The connection authenticates with a short-lived access token in place of a database password. A refresh token, stored in ~/.dagctl/ and readable only by you, keeps the session fresh. dagctl auth logout removes it.

If a project environment is protected, get_state_connection() refuses to connect when SQLMesh targets that environment from your machine unless you are one of its approved users. Deploy to protected environments through dagctl so the change goes through approval.

Documentation

  • Usage: signing in, choosing a project, generating the SQLMesh config, the command reference, the files in ~/.dagctl/, and troubleshooting.
  • API reference: get_state_connection(), get_fresh_token(), and how authentication to the hosted state database works.
  • docs.dagctl.io: the dagctl platform documentation.

License

Apache-2.0

Metadata

Release files for dagctl 0.4.0

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

Source distribution (sdist)

Source distribution for dagctl 0.4.0
File Size Uploaded
dagctl-0.4.0.tar.gz 32.7 kB Details

Built distribution (wheel)

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

Total release size: 58.2 kB

Release files / dagctl-0.4.0.tar.gz

Download URL dagctl-0.4.0.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f579a958d28473ebc199f0cd5f1f9325f7ced4aab9e00d04f0d1a31b219adc90
BLAKE2b-256 checksum
How to use checksums
1ac4481213e02a03c9c225e9b5889389031932dd45bd952b14df9fd85aec29a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / dagctl-0.4.0-py3-none-any.whl

Download URL dagctl-0.4.0-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f02c74567295bbc127bde9d1dc390f685bd69beaec7c7b2c346a6a3bee0e8d6a
BLAKE2b-256 checksum
How to use checksums
9352d0323933e9d9219e21440470e55c1b7cf7b3615b10611268b3165cbb4ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release history Release notifications | RSS feed

0.4.1

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.6

1 release file

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