How To Use Notebook Tools
Notes in Genbots act as modular building blocks for workflows. They encapsulate tasks such as querying databases, performing data transformations, or running advanced analytics, making processes reusable, maintainable, and scalable.
Structure of the Note
-
Note ID: Each note is assigned a unique identifier for execution.
-
Note Name: A human-readable title, such as ” XYZ Report Results”, is used to make the purpose clear.
-
Note Type:
sql
,snowpark_python
- Select SQL for querying databases or Snowpark Python for calculations and programmatically processing the data.
-
Note Content: For SQL: Ensure the query fetches all necessary fields, applies appropriate conditions and filters, and uses proper joins (if needed). For Snowpark Python: Structure the logic in reusable functions for calculations or data wrangling.
-
Parameters (if any): Allows flexibility for input values to modify or tailor queries dynamically.
Step-by-Step: How to Create a Note Using Notebook Tools
The example we will be using will be creating the note used in the “Autonomous Actionable Data Analysis” example.
Step 1: Start By Asking To Create A New Note
Step 2: Provide The Note Details
We provided the above because:
1. Uses a consistent naming convention that highlights the objective. Upon note creation, the note ID will be automatically populated following a naming convention such as <bot_id>_<task_name>_<random_id>
2. we selected SQL as the note type for querying databases.
3. we ensured the query fetches all necessary fields, applies appropriate conditions and filters, and uses proper joins (if needed).
4. If variability is needed, create placeholders for values such as QUARTER
or CAMPAIGN_ID
using Genbots parameter variables.
Example:
-
Parameterized SQL:
WHERE QUARTER = ${quarter}
-
Parameter:
quarter = 2024Q2
Note: For this specific note we want to create a static reusable SQL query that the Genbot can’t change when processing.
- Upon creation of the note, we can now choose to also include it within an autonomous process if needed. To learn more about creating an autonomous process refer to the “How To Use Process Runner Tools” section.
Step 3: Testing The Created Note
Now that the note has been successfully created, you can test the note by simply asking the Genbot to run the note name or note id.