External Functions Tutorial | Snowflake

Veröffentlicht am: 30 Oktober 2021
auf dem Kanal: Knowledge Amplifier
5,649
74

In this demo you'll learn how to expand the capabilities of your Snowflake data pipelines by easily extending them with external services and functionality.

To know more about how different companies are using External Function , you can refer this link --
https://www.vebuso.com/2021/04/bringi...

Prerequisite:
Configuring a Snowflake Storage Integration to Access Amazon S3
   • Configuring a Snowflake Storage Integratio...  

Know about API Gateway in-depth--

What is a Proxy?
   • What is a Proxy?  
Concept of Reverse Proxy & API Gateway
   • Concept of Reverse Proxy & API Gateway  
Introduction to API Gateway with in-depth intuition
   • Introduction to API Gateway with in-depth ...  
Creating a POST Api | AWS API Gateway Passing Data to AWS Lambda
   • Creating a POST Api | AWS API Gateway Pass...  
Working With Query Parameters In API | API Gateway
   • Working With Query Parameters In API | API...  
Create a REST API on AWS | Step by Step Tutorial
   • Create a REST API on AWS | Step by Step Tu...  
Usage Plan & API key - Amazon API Gateway
   • Usage Plan & API key - Amazon API Gateway  

Snowflake External Function Creation Steps:
-----------------------------------------------------------------------
Step 1: Creating Lambda Function
Step 2: Create Rest API
Step 3: Snowflake IAM Role


Demo 1:
--------------

import json

def lambda_handler(event, context):
TODO implement
print(event)
translated=[]
for row in event['data']:
data=row[1]
message="Hello {}".format(data)
translated.append([row[0],message])
return {
'statusCode': 200,
'data': translated
}



Demo 2:
---------------
import json

def lambda_handler(event, context):
TODO implement
print(event)
translated=[]
for row in event['data']:
name=row[1]
department=row[2]
message="{} works in {} Department".format(name, department)
translated.append([row[0],message])
return {
'statusCode': 200,
'data': translated
}


Snowflake Code:
---------------------------
--drop database if required
drop database if exists ramu;
--Create Database
create database if not exists ramu;
use ramu;


CREATE OR REPLACE api integration hellotesting
api_provider = aws_api_gateway
api_aws_role_arn = '{Put your AWS Role here}'
enabled = true
api_allowed_prefixes = ({API Invoke URL});




DESCRIBE integration hellotesting;

create or replace external function helloworld
(Name varchar,Department varchar)
returns variant
api_integration = hellotesting
as {API Invoke URL};

select Name,DEPARTMENT,helloworld(Name,DEPARTMENT) from "DEMO_DB"."PUBLIC"."EMPLOYEE";

Check this playlist for more AWS Projects in Big Data domain:
   • Demystifying Data Engineering with Cloud C...  


Auf dieser Seite können Sie das Online-Video External Functions Tutorial | Snowflake mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Knowledge Amplifier 30 Oktober 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,649 Mal angesehen und es wurde von 74 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!