Snowflake Data Source setup
- From inside your project, click on Data in the Project menu bar. This will open the Data window.
- On the Data Sources page, click the + Add a Data Source button.
- In the popup window, select Snowflake from the list.
- On the Configure window, enter your account and connection credentials, add an optional description, then click Next.
- On the next Authenticate window, enter your Snowflake username and password then click Test Credentials.
- Domino will attempt to connect to the specified database using the user credentials you entered. If all goes well, you will see a message, confirming that the connection was successful. Click Next.
- On the next Permissions screen, click Finish Setup.
Use the Data Source in the Workspace
- Start a Domino Workspace. As the workspace starts up, you will notice a red dot next to Data in the Project menu. Once the Workspace is loaded, click Data.
- The left pane of the screen will expand to show the Data Source. Click the copy icon to copy the connection code associated with the Snowflake Data Source.
- Next, on the Launcher page, click on the Python shortcut in the Notebook section to open a Python Notebook.
-
Use Command + V (on Mac) or Ctrl + V on Windows and Linux to paste the code you copied into the first cell of the notebook. The Data Source functionality in Domino enables users to connect to the database using these templated commands. It will look something like this:
-
Modify the third statement (the query) so that it matches one of your database tables:
This will load the list of states from the database table into a result object, which is then converted into a Pandas dataframe with the following code:
-
Add the following code to display the first few rows of the table:
-
Run the cell to get the following results:
-
As another example, run the following code, with a different query, to count how many weather stations are located in each country (note that the country code takes the first two characters in the station identifier):
The following results are returned:
- Define the query in SQL.
- Use the Data Source to send the query and collect the results.
- Convert the results into a Pandas dataframe.
- Do something productive with the dataframe.