Skip to main content

Compile a dbt model and copy the clean SQL to your clipboard

Project description

dbtcopy

Compile a dbt model and copy the clean SQL to your clipboard — no log noise, no thread counts, no adapter info.

dbt compile dumps a wall of logs to stdout, making it painful to grab just the SQL. dbtcopy runs the compile for you, reads the clean output from target/compiled/, and copies it straight to your clipboard.

Install

pip install dbtcopy

Requires Python 3.9+ and dbt already installed in your environment.

Usage

# Basic — compile and copy to clipboard
dbtcopy my_model

# With dbt target
dbtcopy my_model --target=prod

# With full-refresh
dbtcopy my_model --target=prod --full-refresh

# With dbt vars
dbtcopy my_model --target=prod --vars '{"start_date": "2024-01-01"}'

# Print to stdout instead of clipboard
dbtcopy my_model --print

# Copy AND print
dbtcopy my_model --print-and-copy

# Hide dbt compile output
dbtcopy my_model --quiet

# Skip compile, just grab existing compiled SQL
dbtcopy my_model --no-compile

# Specify dbt project/profiles directory
dbtcopy my_model --project-dir /path/to/project --profiles-dir /path/to/profiles

All arguments after the model name are passed directly to dbt compile.

How it works

  1. Runs dbt compile --select <model> (output shown by default, use --quiet to hide)
  2. Finds <model>.sql in target/compiled/ recursively
  3. Reads the file and copies the contents to your clipboard
  4. Prints a confirmation: Copied 42 lines to clipboard (target/compiled/.../model.sql)
  5. On compile failure, shows the actual dbt error message

Platform support

Clipboard works on:

  • macOSpbcopy
  • Linux (X11)xclip
  • Linux (Wayland)wl-copy
  • WSL / Windowsclip.exe

If no clipboard tool is found, the SQL is printed to stdout as a fallback.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbtcopy-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbtcopy-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dbtcopy-0.1.0.tar.gz.

File metadata

  • Download URL: dbtcopy-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbtcopy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f78015e772b0f942f0e25bf6ba3b16313976c3e028f450af62edebfbb2c0018e
MD5 224c70c90c8b30a6671b7f44d7b552dc
BLAKE2b-256 f7a9834404848dcf52c76f63fd041ce30da68c12a76f83f115eb7aa56862f007

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbtcopy-0.1.0.tar.gz:

Publisher: publish.yml on Tomiwa-dev/dbtcopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbtcopy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dbtcopy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbtcopy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6c676de8eb8772e7e2ec1a9836376fdd3ea1ecaaf6229298b1f9331a5d6685a
MD5 b065cf05acc77f7c8dd3c4faf4438f6e
BLAKE2b-256 d6793dfad4e30972c924db8c2d5a4a8ecf271fb4c6f8fc63b782012d1bb1e77e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbtcopy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Tomiwa-dev/dbtcopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page