DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Amazon Athena and Tableau: Serverless Interactive Query Service and BI

Amazon Athena and Tableau: Serverless Interactive Query Service and BI

Learn how Athena can process both structured and semi-structured data in different file formats, generate reports in connection with BI tools, and more.

Rathnadevi Manivannan user avatar by
Rathnadevi Manivannan
·
Sep. 08, 17 · Tutorial
Like (1)
Save
Tweet
Share
8.03K Views

Join the DZone community and get the full member experience.

Join For Free

Amazon Athena, a serverless query service in Amazon Simple Storage Service (S3) and a pay-per service, is used to easily analyze data using standard SQL in S3. It has a very high query performance, even for huge datasets and complex queries.

Athena can process both structured and semi-structured data in different file formats such as CSV, JSON, Parquet, and ORC. It can be used to generate reports in connection with BI tools. It uses Hive for creating database and tables. As it has metastore, it can be used with Hadoop, Spark, and Presto.

Prerequisites

Sign into AWS console. Then, create your own S3 bucket in S3 to upload data as shown below:

select

select

Lastly, create a database and tables in Athena to query the data.

select

Dataset Description

A sample dataset, containing bank transaction data of a customer, is used in this use case. For sample dataset, scroll down to the References section.

Columns:

  • Step: Maps a unit of time in the real world; in this use case, one step represents one hour of time.
  • Type: Diverse types of payments (i.e. CASH_IN, CASH_OUT, DEBIT, PAYMENT, and TRANSFER).
  • Amount: Amount of transaction in local currency.
  • nameOrig: Customer who started the transaction.
  • oldbalanceOrg: Initial balance before the transaction.
  • newbalanceOrig: New balance after the transaction.
  • NameDest: Customer who is the recipient of the transaction.
  • OldbalanceDest: Initial balance recipient before the transaction.
  • NewbalanceDest: New balance recipient after the transaction.
  • IsFraud: Transactions made by the fraudulent agents inside the simulation.
  • IsFlaggedFraud: An illegal attempt in this dataset is an attempt to transfer more than 200,000 units in a single transaction.

Note: There is no information for customers name starting with M (Merchants).

Use Cases

Data security plays a significant role in almost all sectors, but especially in financial institutions such as banks, credit unions, and so on. As mobile transactions in the financial industry have increased in recent years, it is highly challenging to secure the data in the mobile platform. In this use case, let's discuss finding and managing malicious behavior during mobile transactions.

In this blog, let's discuss the below use cases:

  • Connect Athena with JDBC SQL Workbench Driver.
  • Connect Athena with BI Tools (Tableau 10.3).

Connecting Athena With JDBC SQL Workbench Driver

You can query data from AWS console by connecting JDBC SQL workbench with Athena.

Pre-requisites:

  • Download Athena jar from this path.
  • Ensure the system is configured with Java v1.8.
  • Download SQL workbench if needed from this path.

To connect Athena with JDBC driver using SQL workbench, perform the following:

  • In SQL workbench, choose File > Manage drivers.
  • Perform the configuration shown in the below diagram:select
  • Add a new driver connection by configuring user name and password as your AWS access key and secret key, respectively.
  • Configure your s3_staging_dir in Extended Properties to save your executed queries in your S3 bucket.

select

  • Create a table with SQL Workbench.

select

The table structure is as follows:

select

The data visualization in table format is as follows:

selectThe data is queried as follows:

select

Connecting Athena With BI Tools (Tableau 10.3)

To connect Athena with Tableau, perform the following:

  • Download Athena connector from this path.
  • Place the connector in the C:\Program Files\Tableau\Drivers directory.
  • In Tableau, configure the following:
    • Server: atena.region.com
    • Port: 443
    • S3 Staging Directory: s3://yourbucketname/query_save_folder
    • Access Key ID
    • Secret Access Key

select

Upon successfully creating connections, Athena databases will be listed out as shown in the below diagram:

select

Data Visualization

A few data visualizations are as follows:

Total amount based on type and IsFraud flag:

select

New balance and old balance based on type:

select

Total amount based on type and fraudulent activities:

select

Minimum new balance and minimum old balance based on type:

select

Count of steps for fraudulent types of transactions:

select

Percentage of steps for fraudulent type of activities:

select

References

  • Common Athena and Tableau Errors

  • Skeddly blog

  • Amazon documentation on Athena

Database Data visualization sql AWS

Published at DZone with permission of Rathnadevi Manivannan. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Brief Overview of the Spring Cloud Framework
  • Differences Between Site Reliability Engineer vs. Software Engineer vs. Cloud Engineer vs. DevOps Engineer
  • 5 Factors When Selecting a Database
  • Better Performance and Security by Monitoring Logs, Metrics, and More

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: