Category: Database

by This allows developers to invoke external APIs from within their Snowflake SQL queries and blend the response into their query result, in the same way as if they were internal Snowflake functions. In this article, we will demonstrate how to invoke an API via Amazon Web Services API Gateway that will trigger an AWS Lambda function.

I will then pack the requested exchange rate into a Snowflake-defined JSON format so the External function can interpret the values and blend it into the query result in Snowflake.

This parameter is referred in the API_AWS_ROLE_ARN attribute below: Then the next step is to define the External Function: The AWS IAM Role needs to have an established trust relationship so we need to define a Trust Policy for this role: The required values for the AWS trust policy can be retrieved using : And now we have everything ready to invoke the external function from Snowflake Worksheet: And the result will look like this: This tutorial demonstrates a simple use case of how we can embed external functions into Snowflake SQL and invoke 3rd-party APIs from within SQL.

Related Articles