Develop your notebook
Mix and match SQL, Python, and no-code cells to explore and analyze your data.
- Available on all pricing plans
- Relevant for Admins and Editors with Can Edit or higher project permissions
Hex's Notebook view is built on the familiar notebook format. If you've had experience with Jupyter or similar notebooks, you'll find yourself right at home. Just like in other notebooks, the Notebook view's main interface is composed of cells. However, Hex takes it a step further by offering a range of interactive cell types and expanding on the notebook format in several significant ways. In the following section, we'll delve into how Hex's Notebook view facilitates robust and intuitive data exploration workflows.
Choosing Data
Every great project begins with querying data. You can bring data into your project through a warehouse connection, imported CSV file, or API call. Learn more about connecting your data here.
Data connections
Select the Data sources tab of the left sidebar to see all of the available data connections and their descriptions. Browse the schema of a connected data source by clicking to open it and expanding the section to view the included tables.
To explore the fields in a table, click on the table name and view the metadata as it appears underneath.
If you use dbt Cloud, Hex can use metadata from your dbt project to enrich the Data browser with additional information. Read more about integrating with dbt here.
Select the Query button next to a table to automatically generate a SQL cell and basic query. Edit this query to make it your own!
You can also add a SQL cell by clicking on the green Add Cell button, selecting a data source from the dropdown in the upper left corner of the cell, and writing your query from scratch.
Connecting to and querying a new data source is a quick process from the Data sources tab on the sidebar. Read more about adding new data sources here (link).
Uploaded files
If your data lives in a CSV file, you can upload it from the Files tab of the left sidebar.
Click the three dots next to the filename and select Query in a new SQL cell to automatically generate a basic query.
You can also add a SQL cell using the green Add Cell button and write a query from scratch. Note that you will need to wrap your filename in double quotes (””) for it to query successfully.
Starting with Python
Although many projects start with querying data in SQL and then working with the resulting dataframe in Python, it is possible to skip straight to Python. Add a new Python cell by clicking on the green Add Cell button and write a script to open and read the contents of your CSV file.
import pandas as pd
my_df = pd.read_csv("my_csv_file.csv")
my_df.head()
with open("my_csv_file.csv", "r") as file:
contents = file.read()
Everything in Hex is a cell
Cells are the building blocks of any Hex project, allowing your project to take shape as you add them.
Cell Types
Hex provides a variety of cell types that let you explore, transform, and share insights about your data:
- Code Cells: Support writing SQL.
- Markdown and Text Cells: Support markdown or text.
- Chart Cells: Support out-of-the-box data visualizations, maps, and interactive tables.
- Transform Cells: Support UI-driven reshaping and filtering of data.
- Input Parameter Cells: Support selecting or setting values interactively.
- Data Cells: Support writing back to a connected database table or bringing in dbt metrics.
Build your logic by adding cells
Adding and updating cells
Add new cells from the Add Cell Bar, or keyboard shortcut command-A to add a new cell above your current position, and command-B to add a new cell below your current position.
In the Outline sidebar in the App builder, you can see all of the cells you added to your project in the Notebook View. Select a cell in the outline and drag it into your App builder to add the cell to your app.
You can also add a new markdown or text cell in the App builder by clicking on the white plus sign at the center bottom of your screen.
You can rearrange cells in your Notebook View by hovering your pointer over the upper left corner of a cell, selecting the cell handle when it appears, and dragging the cell up or down.
To remove a cell, click on the three dots at the upper right corner of the cell and select Delete cell from the menu.