Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Build Charts with Amazon Athena Data in Clear Analytics
Create dynamic charts and perform analytics based on Amazon Athena data in Clear Analytics.
The CData ODBC Driver for Amazon Athena enables access to live data from Amazon Athena under the ODBC standard, allowing you work with Amazon Athena data in a wide variety of BI, reporting, and ETL tools and directly, using familiar SQL queries. This article shows how to use Clear Analytics, a Microsoft Excel Add-In, to connect to Amazon Athena as an ODBC source and create queries, tables, and charts (including PivotTables) based on Amazon Athena data.
Connect to Amazon Athena Data
Configure the ODBC Data Source Name
If you have not already done so, provide values for the required connection properties in the data source name (DSN). You can use the built-in Microsoft ODBC Data Source Administrator to configure the DSN. This is also the last step of the driver installation. See the "Getting Started" chapter in the help documentation for a guide to using the Microsoft ODBC Data Source Administrator to create and configure a DSN.
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 AccessKey to the access key Id. Set SecretKey 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:
- Sign into the IAM console.
- In the navigation pane, select Users.
- 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:
- Sign into the AWS Management console with the credentials for your root account.
- Select your account name or number and select My Security Credentials in the menu that is displayed.
- 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 UseEC2Roles to true and leave AccessKey and SecretKey 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 RoleARN. 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 AccessKey and SecretKey of an IAM user to assume the role for. Roles may not be used when specifying the AccessKey and SecretKey of an AWS root user.
Authenticating with MFA
For users and roles that require Multi-factor Authentication, specify the MFASerialNumber and MFAToken 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 TemporaryTokenDuration (default 3600 seconds).
Connecting to Amazon Athena
In addition to the AccessKey and SecretKey properties, specify Database, S3StagingDirectory and Region. Set Region to the region where your Amazon Athena data is hosted. Set S3StagingDirectory to a folder in S3 where you would like to store the results of queries.
If Database is not set in the connection, the data provider connects to the default database set in Amazon Athena.
When you configure the DSN, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.
Configure the Data Source in Clear Analytics
- Open Excel and navigate to the CLEAR ANALYTICS ribbon. Once there, open the Data Manager.
- Select Database as the data source.
- In the Set Connection section, click the option to create a new database.
- Select Microsoft ODBC Data Source as the data source and click OK.
- Select the DSN you already configured from the drop-down menu.
- Back on the Set Connection section, select Standard (ANSI ODBC) Query Builder as the SQL Builder Provider and click Next.
- Select the Schema/Owner and choose the domains (tables) that you wish to use in Clear Analytics.
- Prepare your data objects as needed by customizing the display names and descriptions of the tables and columns.
- For the vast majority of the CData ODBC Drivers, you will not set a key date for your domains.
- In the Domain Relations section, add any relational information between tables.
- In the Domain Tree section, create groups for your data and add the available items to the groups.
- Review the summary of your data and click Finish.
Create a Chart with Amazon Athena Data
You are now ready to create a chart with Amazon Athena data.
Create a New Query
- Click Repository in the CLEAR ANALYTICS ribbon.
- Create a new query.
- Select the columns you wish to retrieve.
- Set the aggregation type for your data (use the blank entry if you do not wish to aggregate the data).
- Set filters and formulas by dragging columns to the lower window.
- Name your query and click Save.
Build a Chart Based on a Query Report
With the query created, you are now ready to execute a report and display a chart.- Click Report Explorer in the CLEAR ANALYTICS ribbon.
- In the Report Explorer pane, click the 'New Report' icon in the toolbar.
- Select the query you just created.
- Name the report and click 'Save and Execute'.
- Click the Results tab within the Report Explorer
- Expand your report and drag the chart to the Excel spreadsheet.
- In the resulting PivotChart window, drag the fields (columns) to the Filters, Legends, Axis (Categories), and Values windows.
With a new data source in Clear Analytics established and a chart created, you are ready to begin analysis of Amazon Athena data. With the ODBC Driver for Amazon Athena and Clear Analytics, you can perform self-service analytics in Excel with live data, directly from Amazon Athena.