cancel
Showing results for 
Search instead for 
Did you mean: 

DataRobot Zepl code snippets make your life easier

RickLowe
Moderator
Moderator

Code snippets are an easy way to save and share reusable notebook paragraphs. Use Zepl code snippets to shorten the learning curve for new users by sharing repetitive tasks such as connecting to data, data preparation, and setting visualization parameters or common color palettes. 

Creating a code snippet 

  1. In a notebook, create a paragraph with the desired code or text to save.
  2. Select the gear icon for paragraph settings.
  3. Select Add to code snippets.
    RickLowe_0-1634235390641.png

     

All code snippets created by members of your Zepl organization will be accessible from inside any notebook. To find them, open the notebook and click the code snippet icon from the right-hand menu.

RickLowe_0-1634235950231.png

 

You can read the doc to learn more. And, if you have any questions about this, shoot them my way! @RickLowe 

Labels (3)
1 Reply
Dan_Maloney
DataRobot Employee
DataRobot Employee

@RickLowe , thanks for sharing.  Super valuable feature.  I've heard from many customers about their best practices for how they use DataRobot Zepl code snippets.  I commonly hear that one of the first code snippets they setup most often is associated with getting access to their data. 

 

Here's one of the most used code snippets to get rolling with Snowflake once you have setup your datasource in Zepl but similar snippets could apply to AWS Redshift, AWS S3, Google Big Query, Presto, Postgres, etc.  I've added both a simple SQL and Python code snippet below:

 

Simple SQL Statement for Exploratory Data Analysis (EDA)

%datasource.snowflake_zepl
Select * from <table_name>

 

Simple Python Code for EDA

%python
import pandas as pd

# Create a Snowflake Cursor Object
cur = z.getDatasource("snowflake_zepl")

# Select the 1k rows from Snowflake
cur.execute("select * from <table_name>")

# convert datasource into pandas dataframe
df = cur.fetch_pandas_all()

# print dataframe as table
z.show(df)

 

I've also added the associated Snowflake datasource that I setup within DataRobot Zepl which is what I attached to with the code snippet in my notebook for some additional context.

 

Dan_Maloney_1-1634774143164.png