Metadata-Version: 2.4
Name: dbtcopy
Version: 0.1.0
Summary: Compile a dbt model and copy the clean SQL to your clipboard
Project-URL: Homepage, https://github.com/tomiwa-dev/dbtcopy
Project-URL: Repository, https://github.com/tomiwa-dev/dbtcopy
Author: Tomiwa
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Requires-Python: >=3.9
Requires-Dist: click>=8.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install dbtcopy
```

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

## Usage

```bash
# 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:
- **macOS** — `pbcopy`
- **Linux (X11)** — `xclip`
- **Linux (Wayland)** — `wl-copy`
- **WSL / Windows** — `clip.exe`

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

## License

MIT
