This repo is created to demonstrate how to integrate Athena User Defined Function (UDF) with Amazon SageMaker
The Amazon Athena Query Federation SDK allows you to customize Amazon Athena with your own code. This enables you to integrate with new data sources, proprietary data formats, or build in new user defined functions. Initially these customizations will be limited to the parts of a query that occur during a TableScan operation but will eventually be expanded to include other parts of the query lifecycle using the same easy to understand interface.
This functionality is currently in Public Preview while customers provide us feedback on usability, ease of using the service or building new connectors. We do not recommend that you use these connectors in production or use this preview to make assumptions about the performance of Athena’s Federation features. As we receive more feedback, we will make improvements to the preview and increase limits associated with query/connector performance, APIs, SDKs, and user experience. The best way to understand the performance of Athena Data Source Connectors is to run a benchmark when they become generally available (GA) or review our performance guidance.
To enable this Preview feature you need to create an Athena workgroup named AmazonAthenaPreviewFunctionality and run any queries attempting to federate to this connector, use a UDF, or SageMaker inference from that workgroup.
tldr; Pre-reqs to Get Started:
- Ensure you have the proper permissions/policies to deploy/use Athena Federated Queries
- Ensure latest version of SAM CLI is intalled (Tested with 0.45.0)
- Ensure SageMaker Java SDK is installed on the machine
- Ensure Amazon SageMaker Java SDK is added in Maven Local repo. If not, add
<packaging>jar</packaging>
in SageMaker SDK pom.xml, then compile with Maven commandmvn clean install
. - Navigate to Servless Application Repository and search for "athena-federation". Be sure to check the box to show entries that require custom IAM roles. Look for entries published by the "Amazon Athena Federation" author named "AthenaUserDefinedFunctions"
- Deploy the application
- Go to the Athena Console in us-east-1 (N. Virginia) and create a workgroup called "AmazonAthenaPreviewFunctionality", any queries run from that workgroup will be able to use Preview features described in this repository.
- Run a query "show databases in `lambda:<func_name>`" where <func_name> is the name of the Lambda function you deployed in the previous steps.
- Go to "athena-udfs" folder on this repo and follow instruction there to create custom Athena UDF with Amazon SageMaker
For more information please consult:
- Intro Video
- SDK ReadMe
- Quick Start Guide
- Available Connectors
- Federation Features
- How To Build A Connector or UDF
- Gathering diagnostic info for support
- Frequently Asked Questions
- Common Problems
- Installation Pre-requisites
- Known Limitations & Open Issues
- Predicate Pushdown How-To
- Our Github Wiki.
- Java Doc
This project is licensed under the Apache-2.0 License.