OData is a major protocol enabling real-time communication among cloud-based, mobile, and other online applications. The CData API Server provides Snowflake data to OData consumers like TIBCO Spotfire. This article shows how to use the API Server and Spotfire's built-in support for OData to access Snowflake data in real time.
About Snowflake Data Integration
CData simplifies access and integration of live Snowflake data. Our customers leverage CData connectivity to:
- Reads and write Snowflake data quickly and efficiently.
- Dynamically obtain metadata for the specified Warehouse, Database, and Schema.
- Authenticate in a variety of ways, including OAuth, OKTA, Azure AD, Azure Managed Service Identity, PingFederate, private key, and more.
Many CData users use CData solutions to access Snowflake from their preferred tools and applications, and replicate data from their disparate systems into Snowflake for comprehensive warehousing and analytics.
For more information on integrating Snowflake with CData solutions, refer to our blog: https://www.cdata.com/blog/snowflake-integrations.
Getting Started
Set Up the API Server
If you have not already done so, download the CData API Server. Once you have installed the API Server, follow the steps below to begin producing secure Snowflake OData services:
Connect to Snowflake
To work with Snowflake data from TIBCO Spotfire, we start by creating and configuring a Snowflake connection. Follow the steps below to configure the API Server to connect to Snowflake data:
- First, navigate to the Connections page.
-
Click Add Connection and then search for and select the Snowflake connection.
π Selecting a data source (SQLite is shown)
-
Enter the necessary authentication properties to connect to Snowflake.
To connect to Snowflake:
- Set User and Password to your Snowflake credentials and set the AuthScheme property to PASSWORD or OKTA.
- Set URL to the URL of the Snowflake instance (i.e.: https://myaccount.snowflakecomputing.com).
- Set Warehouse to the Snowflake warehouse.
- (Optional) Set Account to your Snowflake account if your URL does not conform to the format above.
- (Optional) Set Database and Schema to restrict the tables and views exposed.
- (Optional) If MFA is enabled on your Snowflake account (via Duo Security), set MFACode to the passcode generated by your Duo authenticator app.
See the Getting Started guide in the CData driver documentation for more information.
π Connecting to a datasource (SQLite is shown)
-
After configuring the connection, click Save & Test to confirm a successful connection.
Configure API Server Users
Next, create a user to access your Snowflake data through the API Server. You can add and configure users on the Users page. Follow the steps below to configure and create a user:
- On the Users page, click Add User to open the Add User dialog.
-
Next, set the Role, Username, and Privileges properties and then click Add User.
π Configure a new user
-
An Authtoken is then generated for the user. You can find the Authtoken and other information for each user on the Users page:
π API Server user settings
Creating API Endpoints for Snowflake
Having created a user, you are ready to create API endpoints for the Snowflake tables:
-
First, navigate to the API page and then click
Add Table
.
π Add tables
-
Select the connection you wish to access and click Next.
π Select the connection (SQLite is shown)
-
With the connection selected, create endpoints by selecting each table and then clicking Confirm.
π Adding tables from the connection (SQLite is shown)
Gather the OData Url
Having configured a connection to Snowflake data, created a user, and added resources to the API Server, you now have an easily accessible REST API based on the OData protocol for those resources. From the API page in API Server, you can view and copy the API Endpoints for the API:
π API Endpoints
Create Data Visualizations on External Snowflake Data
- Open Spotfire and click Add Data Tables -> OData.
- In the OData Connection dialog, enter the following information:
π Required connection settings to connect to the API Server.
- Select the tables and columns you want to add to the dashboard. This example uses Products.
π API Server API Entities. (Salesforce is shown.)
- If you want to work with the live data, click the Keep Data Table External option. This option enables your dashboards to reflect changes to the data in real time.
If you want to load the data into memory and process the data locally, click the Import Data Table option. This option is better for offline use or if a slow network connection is making your dashboard less interactive.
- After adding tables, the Recommended Visualizations wizard is displayed. When you select a table, Spotfire uses the column data types to detect number, time, and category columns. This example uses ProductName in the Numbers section and Id in the Categories section.π Recommended visualizations for the imported data table. (Salesforce is shown.)
After adding several visualizations in the Recommended Visualizations wizard, you can make other modifications to the dashboard. For example, you can apply a filter: After clicking the Filter button, the available filters for each query are displayed in the Filters pane.