VOOZH about

URL: https://www.cdata.com/kb/tech/athena-cloud-retool.rst

⇱ Seamlessly Bring Amazon Athena Data into Retool Using CData Connect AI


Seamlessly Bring Amazon Athena Data into Retool Using CData Connect AI

πŸ‘ Mohsin Turki
Mohsin Turki
Technical Marketing Engineer
Integrate Amazon Athena data into Retool with CData Connect AI to build smarter apps and streamline workflows with real-time data access.

Retool enables the rapid creation of custom internal tools using a low-code or no-code approach. By integrating Amazon Athena into Retool with CData Connect AI, you can access live data from Amazon Athena in real time, enabling you to build more efficient apps and streamline workflows.

This guide walks you through the simple steps to connect Amazon Athena to Retool via CData Connect AI using OpenAPI or the Virtual SQL Server API. You can securely connect to your Amazon Athena data, ensuring seamless integration and real-time updates, empowering you to create smarter apps and enhance operational efficiency. Let's get started!

About Amazon Athena Data Integration

CData provides the easiest way to access and integrate live data from Amazon Athena. Customers use CData connectivity to:

  • Authenticate securely using a variety of methods, including IAM credentials, access keys, and Instance Profiles, catering to diverse security needs and simplifying the authentication process.
  • Streamline their setup and quickly resolve issue with detailed error messaging.
  • Enhance performance and minimize strain on client resources with server-side query execution.

Users frequently integrate Athena with analytics tools like Tableau, Power BI, and Excel for in-depth analytics from their preferred tools.

To learn more about unique Amazon Athena use cases with CData, check out our blog post: https://www.cdata.com/blog/amazon-athena-use-cases.


Getting Started


Configure the Amazon Athena Connectivity for Retool (in CData Connect AI)

Overview

Here is an overview of the steps:

  1. Configure: (Optional) Set up your Amazon Athena data source in CData Connect AI, add a Workspace, add assets to your Workspace, and generate a Personal Access Token (PAT).
  2. Connect: Link Retool to CData Connect AI using OpenAPI or the Virtual SQL Server API.
  3. Explore: Use your connected data to build smarter apps and explore advanced integrations.

Prerequisites

Ensure you have the following before starting:

  1. An active Amazon Athena account and credentials.
  2. A CData Connect AI account. Log in or sign up for a free trial here.
  3. A Retool account. Sign up here.


Connect to Amazon Athena from Connect AI

CData Connect AI uses a straightforward, point-and-click interface to connect to data sources.

  1. Log into Connect AI, click Sources, and then click Add Connection
  2. πŸ‘ Adding a Connection
  3. Select "Amazon Athena" from the Add Connection panel
  4. πŸ‘ Selecting a data source
  5. Enter the necessary authentication properties to connect to Amazon Athena.

    Authenticating to Amazon Athena

    To authorize Amazon Athena requests, provide the credentials for an administrator account or for an IAM user with custom permissions: Set to the access key Id. Set to the secret access key.

    Note: Though you can connect as the AWS account administrator, it is recommended to use IAM user credentials to access AWS services.

    Obtaining the Access Key

    To obtain the credentials for an IAM user, follow the steps below:

    1. Sign into the IAM console.
    2. In the navigation pane, select Users.
    3. To create or manage the access keys for a user, select the user and then select the Security Credentials tab.

    To obtain the credentials for your AWS root account, follow the steps below:

    1. Sign into the AWS Management console with the credentials for your root account.
    2. Select your account name or number and select My Security Credentials in the menu that is displayed.
    3. Click Continue to Security Credentials and expand the Access Keys section to manage or create root account access keys.

    Authenticating from an EC2 Instance

    If you are using the CData Data Provider for Amazon Athena 2018 from an EC2 Instance and have an IAM Role assigned to the instance, you can use the IAM Role to authenticate. To do so, set to true and leave and empty. The CData Data Provider for Amazon Athena 2018 will automatically obtain your IAM Role credentials and authenticate with them.

    Authenticating as an AWS Role

    In many situations it may be preferable to use an IAM role for authentication instead of the direct security credentials of an AWS root user. An AWS role may be used instead by specifying the . This will cause the CData Data Provider for Amazon Athena 2018 to attempt to retrieve credentials for the specified role. If you are connecting to AWS (instead of already being connected such as on an EC2 instance), you must additionally specify the and of an IAM user to assume the role for. Roles may not be used when specifying the and of an AWS root user.

    Authenticating with MFA

    For users and roles that require Multi-factor Authentication, specify the and connection properties. This will cause the CData Data Provider for Amazon Athena 2018 to submit the MFA credentials in a request to retrieve temporary authentication credentials. Note that the duration of the temporary credentials may be controlled via the (default 3600 seconds).

    Connecting to Amazon Athena

    In addition to the and properties, specify , and . Set to the region where your Amazon Athena data is hosted. Set to a folder in S3 where you would like to store the results of queries.

    If is not set in the connection, the data provider connects to the default database set in Amazon Athena.

    πŸ‘ Configuring a connection (Salesforce is shown)
  6. Click Save & Test
  7. Navigate to the Permissions tab in the Add Amazon Athena Connection page and update the User-based permissions. πŸ‘ Updating permissions

Add a Personal Access Token

When connecting to Connect AI through the REST API, the OData API, or the Virtual SQL Server, a Personal Access Token (PAT) is used to authenticate the connection to Connect AI. It is best practice to create a separate PAT for each service to maintain granularity of access.

  1. Click on the Gear icon () at the top right of the Connect AI app to open the settings page.
  2. On the Settings page, go to the Access Tokens section and click Create PAT.
  3. Give the PAT a name and click Create. πŸ‘ Creating a new PAT
  4. The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.

Configure Amazon Athena Endpoints for Retool

After connecting to Amazon Athena, create a workspace for your desired table(s).

  1. Navigate to the Workspaces page and click Add to create a new Workspace (or select an existing workspace). πŸ‘ The Workspaces page.
    πŸ‘ Adding a new Workspace.
  2. Click Add to add new assets to the Workspace.
  3. Select the Amazon Athena connection (e.g. AmazonAthena1) and click Next. πŸ‘ Selecting an Asset (Salesforce is shown).
  4. Select the table(s) you wish to work with and click Confirm. πŸ‘ Selecting Tables (Salesforce is shown).
  5. Make note of the OpenAPI URL or the Virtual SQL Server URL for your workspace, e.g. https://cloud.cdata.com/api/openapi/v3/{workspace_name}...

With the connection, PAT, and Workspace configured, you are ready to connect to Amazon Athena data from Retool.


Connect Retool to Amazon Athena in CData Connect AI

Now that you've configured your Amazon Athena connection in CData Connect AI, it's time to integrate it with Retool.

Retool can be connected to Amazon Athena in CData Connect AI via either OpenAPI or the Virtual SQL Server API. Choose the method that best suits your workflow:

Connect via OpenAPI

To connect using the OpenAPI specification, follow these steps:

  1. On CData Connect AI, from the left-hand side, go to Workspaces then select a Workspace.
  2. Click the View Endpoints, and under the OpenAPI, copy the OpenAPI URL for the workspace. Keep the default options. See OpenAPI section for more information. πŸ‘ Copying OpenAPI URL in CData Connect AI
  3. Login to Retool and then go to the Resources tab, click Create new > Resource.
  4. In the Select a resource type search bar, and search for OpenAPI.
  5. Click OpenAPI. The Configure OpenAPI screen appears. Enter the following information to configure the OpenAPI connector:
    • Name: The Connection Name to identify the connector on Retool.
    • Specification URL: The OpenAPI URL you copied from the Workspace in CData Connect AI. Paste the URL here.
    • Forward headers when fetching OpenAPI spec: Check this box.
    • Under the URL parameters, keep the key-value pair unchanged.
    • In the Headers section, write the key as Authorization and in the value, write Basic.
    • For the Basic connection value, Retool requires a base64-encoded version of your CData Connect AI username:PAT combination (where PAT is the token you generated earlier). Use a tool like this to encode the value. For example, [email protected]:12345 encodes to dGVzdEBjZGF0YS5TIzNDU=. Copy this encoded value and paste it into the value field after Basic with a space.
    • Username: Enter your CData Connect AI username. This is displayed in the top-right corner of the CData Connect AI interface. For example, [email protected].
    • Password: Enter the PAT you generated on the Settings page.
    πŸ‘ Configuring OpenAPI Resource in Retool
  6. Click Test connection to test your connection configuration. Once you have a successful connection, click Create resource.
  7. Create the app in Retool in which to integrate your data.
  8. Click Create resource query. πŸ‘ Resource Query Screen for OpenAPI in Retool
  9. Select the new resource you created, and view the endpoints that are available. πŸ‘ Resource Query Screen for OpenAPI in Retool
  10. You can now build your app with your live Amazon Athena data. πŸ‘ Resource Query Screen for OpenAPI in Retool

Connect via Virtual SQL Server API

To connect using the Virtual SQL Server API, follow these steps:

  1. Login to Retool, then go to Resources. Click Connect New at the top-right and select Resources.
  2. πŸ‘ Retool OpenAPI Resource Search
  3. Enter Microsoft SQL in the search bar, click the resulting option, and enter the following details:
  4. πŸ‘ Microsoft SQL Resource Searched in Retool
    • Name: A name for the connection to CData Connect AI.
    • Host: tds.cdata.com.
    • Port: 1433.
    • Database Name: Enter the Connection Name of the CData Connect AI data source you want to connect to (for example, Salesforce1).
    • Database Username: Enter your CData Connect AI username. This is displayed in the top-right corner of the CData Connect AI interface. For example, [email protected].
    • Database Password: Enter the PAT you generated on the Settings page.
    πŸ‘ Microsoft SQL Resource Details in Retool
  5. Click Test Connection. If the connection fails, you might need to whitelist CData Connect AI IPs for Retool and other data sources. Check out the documentation here.
  6. If it succeeds, click Create Resource.
  7. Your connection is now set up, and you can build your app with live Amazon Athena data.

Build Retool Apps with Your Live Amazon Athena Data

Now that you have integrated Amazon Athena with Retool using CData Connect AI, it's time to utilize your live data to its full potential. Let's build a simple app:

  • Step 1: Set Up the Table (on home screen)
    • Create a New App in Retool.
    • Select your Amazon Athena connection.
    • Add a Table component and bind it to Amazon Athena's data.
    • πŸ‘ New App in Retool
  • Step 2: Add Filters (on top-right)
  • Step 3: Display Key Metrics (below Table)
    • Add a Text component to show Total Amount of filtered opportunities.
    • Use a query to sum the Amount for filtered data.
  • Step 4: Add Visuals (top-right or side panel)
    • Add a Bar Chart to visualize opportunities by Stage.
    • Add a Line Chart to show Expected Revenue over time.
  • Step 5: Test and Deploy (top-right)
    • Test filters, search, and charts.
    • Deploy the app and share the link for access.

With these steps, you've successfully created a dynamic app to manage and visualize your Salesforce opportunities. Enjoy exploring your live data and leveraging it for better insights!


Try CData Connect AI Free for 14 Days

Experience real-time Amazon Athena data access and enhanced app development with CData Connect AI in Retool. Start your free trial today!