Chalk home page
Docs
API
CLI
  1. Magics

Chalk provides a set of IPython magics to improve the experience of defining resolvers in notebooks.

Cell Magics

%%resolver

You can define a SQL resolver in a notebook cell using the %%resolver magic. The magic will parse the cell contents and upload your resolver to your current working branch.

%%resolver needs to be followed by a resolver name, e.g. root_authorization_resolver as shown below.

Refer to the section on SQL Resolvers to learn more about how to define resolvers.

notebook.ipynb
%%resolver root_authorization_resolver
-- resolves: Authorization
-- source: snowflake
SELECT
    id,
    amount_in_cents,
    card_id,
    merchant_id,
    created_at as authorized_at
FROM authorizations

Chalk lines up the names of your target SQL columns with the names of your features. In this case, we have an Authorization feature class that contains a features called authorized_at. However, our Snowflake table has a column called created_at that we want to use to populate the authorized_at feature. So, we use the as keyword to rename the column in our resolver.