{"id":38690128,"url":"https://github.com/butchland/nbdbt","last_synced_at":"2026-01-17T10:31:12.136Z","repository":{"id":44403919,"uuid":"505001562","full_name":"butchland/nbdbt","owner":"butchland","description":"Use notebooks for dbt development","archived":false,"fork":false,"pushed_at":"2022-09-22T11:06:48.000Z","size":152,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T02:13:40.196Z","etag":null,"topics":["dbt","jupyter-notebooks","nbdev"],"latest_commit_sha":null,"homepage":"https://butchland.github.io/nbdbt","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/butchland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"butchland"}},"created_at":"2022-06-19T03:18:38.000Z","updated_at":"2022-09-21T18:33:06.000Z","dependencies_parsed_at":"2023-01-18T15:54:43.854Z","dependency_job_id":null,"html_url":"https://github.com/butchland/nbdbt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"fastai/nbdev_template","purl":"pkg:github/butchland/nbdbt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butchland%2Fnbdbt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butchland%2Fnbdbt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butchland%2Fnbdbt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butchland%2Fnbdbt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/butchland","download_url":"https://codeload.github.com/butchland/nbdbt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butchland%2Fnbdbt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28506588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt","jupyter-notebooks","nbdev"],"created_at":"2026-01-17T10:31:11.617Z","updated_at":"2026-01-17T10:31:12.124Z","avatar_url":"https://github.com/butchland.png","language":"Jupyter Notebook","funding_links":["https://github.com/sponsors/butchland"],"categories":[],"sub_categories":[],"readme":"# nbdbt\n\u003e Use jupyter notebooks for dbt development\n\n\n[`dbt`](https://getdbt.com) (data build tool) is revolutionizing the way we do the process of extracting value from our data. \n\nThis package allows Jupyter notebooks to be used for developing dbt models and analyses in complement with other dbt command line tools and VS Code extensions.\n\n## Install\n\n`pip install git+https://github.com/butchland/nbdbt.git`\n\n## How to use\n\nThe `%%dbt` cell magic allows you to create models and analyses in your dbt project.\n\n\nTo use the `%%dbt` cellmagic in your notebook, you have to load the dbt cellmagic module first via `%load_ext` or `%reload_ext` line magics \n\n```\n# load dbt cell magic\n%reload_ext nbdbt.dbt_cellmagic\n```\n\nThe `%dbtconfig` line magic configures a default project (and optionally the dbt profiles directory with `-d` flag as well as the notebook path with the `-n` flag).\n\n```\n%dbtconfig -p ../my_dbt_project -n notebooks/index.ipynb\n```\n\nThe next cell uses the `%%dbt` cell magic which will create a new model `my_third_model` and compile it as well.\n\n```\n%%dbt -a my_fourth_model models/my_fourth_model.sql\nselect *\nfrom {{ ref('my_second_dbt_model') }}\n```\n\nWe then assigned the result of the compilation to the `my_third_model` variable, which is a Dbt (cell) magic object\n\n```\n# skip_test\nmy_fourth_model\n```\n\n\n\n\n    \u003cnbdbt.dbt_cellmagic.DbtMagicObject at 0x7f869b4b7890\u003e\n\n\n\nThe `ref` method on `DbtMagicObject`  allows us to run the query and save the results into a dataframe.\n\n```\n# skip_test\nresults = my_fourth_model.ref()\nresults  # dataframe\n```\n\n\n\n\n\u003cdiv\u003e\n\u003cstyle scoped\u003e\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n\u003c/style\u003e\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003eid\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003e1\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n\nThe dbt magic object also has access to other useful properties (like the compiled sql used to create the results)\n\n```\n# skip_test\nprint(my_fourth_model._compiled_sql)\n```\n\n    -- AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/index.ipynb (unless otherwise specified).\n    select *\n    from `sample-dbt-learn-project`.`jaffle_shop`.`my_second_dbt_model`\n\n\nWe can then run the usual _dbt_ commands to generate the model \n\n```\n# no_test\n%cd ../my_dbt_project\n! dbt run --select my_fourth_model\n%cd ../nbs\n```\n\n    /home/butch2/play/experiments/nbdbt/nbs\n    10:20:23  Running with dbt=1.1.1\n    10:20:23  Found 3 models, 4 tests, 0 snapshots, 3 analyses, 191 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics\n    10:20:23  \n    10:20:25  Concurrency: 1 threads (target='dev')\n    10:20:25  \n    10:20:25  1 of 1 START view model jaffle_shop.my_fourth_model ............................ [RUN]\n    10:20:26  1 of 1 OK created view model jaffle_shop.my_fourth_model ....................... [\u001b[32mOK\u001b[0m in 1.28s]\n    10:20:26  \n    10:20:26  Finished running 1 view model in 2.97s.\n    10:20:26  \n    10:20:26  \u001b[32mCompleted successfully\u001b[0m\n    10:20:26  \n    10:20:26  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1\n    /home/butch2/play/experiments/nbdbt/nbs\n\n\n```\n# skip_test\nimport nbdbt.dbt_cellmagic as nbc\n\nnbc.clear_cache()  # clears nbdtcache\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutchland%2Fnbdbt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbutchland%2Fnbdbt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutchland%2Fnbdbt/lists"}