Giter Site home page Giter Site logo

dbt-ipy's Introduction

dbt-iPy

Run dbt commands inside a IPython session.

Installation

pip install dbt-ipy

Tutorial

You can access the tutorial notebook here

Quickstart Guide

Load the extension

%load_ext dbt-ipy

Connect to dbt RPC

The next thing you'll probably want to do is to run a dbt RPC server in the background. That will let you run queries, compile SQL code among other things:

%dbt rpc <args> (the args will be passed directly to dbt as command line arguments)

The two most important parameters would be:

  • --port [port_number] Passing this parameter will run the dbt RPC on that port. Default is 8580
  • --existing This will skip creating a new dbt RPC and instead it will connect to an existing one on the specified port

Custom magic commands

Compiling queries

The sql query in the cell will be compiled with the dbt RPC server and IPython will output the text::

%%compile_sql
SELECT ...

Running queries

The sql query in the cell will be run on the dbt RPC server and IPython will output the agate table. Also, it will run its .print_table() method::

%%run_sql
SELECT ...

Copying to clipboard

It is also possible to copy the last result returned by dbt to the clipboard. If that's a %%compile_sql compiled query it will return the SQL text but if it's a %%run_sql table, it will transform it to CSV and copy that to the clipboard. You can then paste the contents of the clipboard into a spreadsheet as usual.

%dbt_clipboard

dbt-ipy's People

Contributors

jmriego avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.