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
In a notebook, create a paragraph with the desired code or text to save.
Select the gear icon for paragraph settings.
Select Add to code snippets.
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.
You can read the doc to learn more. And, if you have any questions about this, shoot them my way! @RickLowe
@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)
Select * from <table_name>
Simple Python Code for EDA
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
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.