Rakam

Creating Recipes

The recipes in Rakam are simply the dbt projects, an open-source data modeling tool by Fishtown Analytics. We heavily rely on dbt's resources properties and extend them in order for you to build a semantic layer on top of your data. For those who're not familiar with dbt, we have an embedded IDE that lets you create dbt models from your data but we strongly advise you to go through dbt's tutorials or at least learn the concept.

Introduction to Rakam for beginners

Once you create your first recipe, you can create your first model from your tables in your database. In dbt, we call them source.

In order to create a source, click the + Create dropdown in the sidebar, click the Create file button and select the tables that you're going to analyze. Once you import the tables, The IDE will create a dbt resource file that can be modified for your use case.

Introduction to Rakam for dbt users

If you're already using dbt, you can integrate Rakam to your dbt project connecting to your GIT repository. Click the Integrate your GIT repository button on Develop page and connect to your repository. Please note that if your repository is private, you need to add the generated SSH key into your repository for Rakam to be able to access your repository.

Once you connect to your repository, we will automatically synchronize your models, seeds, and sources. By default, we create dimensions for each column definitions in your resource files but since dbt doesn't provide any way to define metrics, we make use of the meta property as follows:

models:
 - name: customers
   columns:
     - name: country_code
       meta:
         rakam.dimension:
           type: string
     - name: city
       meta:
         rakam.dimension:
           type: string
     - name: total_customers
       description: total number of customers defined as count(*) in sql
       meta:
         rakam.measure:
            aggregation: sum

In addition to column mapping, you can also create custom measures and dimensions by defining them under meta or the model:

models:
  - name: customers
    meta:
      rakam:
         measures:
            total_rows:
               aggregation: count
         dimensions:
            full_location:
                sql: CONCAT({{TABLE}}.country, {{TABLE}}.city)   
                type: string

You can see the full list of properties that you can use under model.meta and column.meta here.

Variables

You can customize your recipe using the variables. They allow you to get data from the user who is installing the recipe. If you want them to customize the recipe or enter the required values, define the variables under rakam_project.yml and they will be visible as form components to the user while installing the recipes. The values the user entered will be injected into your recipe using external variables in the config file. (i.e var('variableName')). Here are the allowed values for the type of variables:

Type names

Description

Extra Properties

numeric, string, boolean`

primitive values

dropdown, choice

being used for allowing the user to select one or more items.

multiple: true and choices: []

model, dimension, measure

can be used if you need extra model definitions in your recipe.

table, schema, and table-column

can be used if you want to use it to provide database relations.

target

can be used if you want the user to select the target a materialized SQL model.

Updated 3 days ago

Creating Recipes


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.