<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSIS Amazon S3 CSV Source Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-amazon-s3-csv-source/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-amazon-s3-csv-source/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Fri, 22 Nov 2019 06:09:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>SSIS Amazon S3 CSV Source Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-amazon-s3-csv-source/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Read Amazon S3 Storage Files in SSIS (CSV, JSON, XML)</title>
		<link>https://zappysys.com/blog/read-amazon-storage-s3-files-ssis-csv-json-xml/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 16 Mar 2019 09:43:13 +0000</pubDate>
				<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[SSIS Amazon S3 Connection]]></category>
		<category><![CDATA[SSIS Amazon S3 CSV Source]]></category>
		<category><![CDATA[SSIS Amazon S3 JSON Source]]></category>
		<category><![CDATA[SSIS Amazon S3 XML Source]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6544</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw how to load data into Amazon S3. Now in this blog, we will see How to read Amazon S3 Storage Files in SSIS (CSV, JSON, XML Format files). To illustrate, we will use ZappySys SSIS PowerPack, which includes several tasks to import/export data from multiples sources to multiple destinations [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-amazon-storage-s3-files-ssis-csv-json-xml/">Read Amazon S3 Storage Files in SSIS (CSV, JSON, XML)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/s3.png" target="_blank" rel="noopener"><img decoding="async" class="alignleft wp-image-6547 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/s3-e1553183075864.png" alt="Amazon S3 - AWS Storage" width="150" height="150" /></a>In our previous blog we saw <a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/" target="_blank" rel="noopener">how to load data into Amazon S3</a>. Now in this blog, we will see <strong>How to read Amazon S3 Storage Files in SSIS (CSV, JSON, XML Format files)</strong>. To illustrate, we will use <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a>, which includes several tasks to import/export data from multiples sources to multiple destinations like flat files, Azure, AWS, databases, Office files and more. They are Coding free, drag and drop high-performance suite of <em>Custom SSIS Components</em> and <em>SSIS Tasks.</em> If you like perform File operations on Amazon S3 Files (e.g. Download, Upload, Create, Delete) then <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-amazon-storage-task/" target="_blank" rel="noopener">check these articles</a>.</p>
<p>In nutshell, this post will focus on how to Read Amazon S3 Storage CSV, JSON and XML Files using respective SSIS Source tasks.</p>
<p>&nbsp;</p>
<p><strong>Components Mentioned in this article</strong><br />
<div class="su-table su-table-alternate">
<table style="width: 407px;height: 187px">
<tbody>
<tr>
<td style="width: 35px"><img decoding="async" src="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-csv-source/ssis-amazon-s3-csv-file-source.png?w=720&amp;ssl=1" alt="SSIS Amazon S3 CSV File Source" width="32" height="32" /></td>
<td style="width: 356px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">Amazon S3 CSV File Source</a></td>
</tr>
<tr>
<td style="width: 35px"><img loading="lazy" decoding="async" src="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-csv-destination/ssis-amazon-s3-csv-file-destination.png?w=720&amp;ssl=1" alt="SSIS Amazon S3 CSV File Destination" width="32" height="32" /></td>
<td style="width: 356px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-destination/" target="_blank" rel="noopener">Amazon S3 CSV File Destination</a></td>
</tr>
<tr>
<td style="width: 35px"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-xml-source/ssis-amazon-s3-xml-file-source.png?w=720&amp;ssl=1" alt="SSIS Amazon S3 XML File Source" width="32" height="32" /></td>
<td style="width: 356px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-xml-file-source/" target="_blank" rel="noopener">Amazon S3 XML File Source</a></td>
</tr>
<tr>
<td style="width: 35px"><img loading="lazy" decoding="async" src="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-json-source/ssis-amazon-s3-json-file-source.png?w=720&amp;ssl=1" alt="SSIS Amazon S3 JSON File Source" width="32" height="32" /></td>
<td style="width: 356px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-json-file-source/" target="_blank" rel="noopener">Amazon S3 JSON File Source</a><b></b></td>
</tr>
</tbody>
</table>
</div>
<h2>Prerequisite</h2>
<ol>
<li>First, you will need to have SSIS installed</li>
<li>Secondly, make sure to have SSDT</li>
<li>You have obtained Amazon S3 account access key / secret key.</li>
<li>Finally, do not forget to install ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a></li>
</ol>
<h2>What is Amazon S3 Storage</h2>
<p>Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9&#8217;s) of durability, and stores data for millions of applications for companies all around the world.</p>
<h2>Getting Started</h2>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/#cat_amazon_aws_cloud" target="_blank" rel="noopener">SSIS Amazon S3 Source for CSV/JSON/XML File</a> that will help you in reading CSV, JSON and XML Files from Amazon S3 to the Local machine, Upload files(s) to Amazon S3 Storage. It will also support Delete, Rename, List, Get Property, Copy, Move, Create, Set Permission … and many more operations. Here we are showing you is, How to download files from Amazon S3 Storage.</p>
<p>You can connect to your <a href="https://console.aws.amazon.com/?nc2=h_m_mc" target="_blank" rel="noopener">Amazon S3 Account</a> by entering your storage account credentials.</p>
<h2>Read Amazon S3 Storage Files in SSIS (CSV, JSON, XML)</h2>
<p>Let´s start with an example. In this SSIS Amazon S3 Source for CSV/JSON/XML File task example, we will read CSV/JSON/XML files from Amazon S3 Storage to SQL Server database.</p>
<ol>
<li>First of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.
<div id="attachment_7934" style="width: 470px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7934" class="wp-image-7934 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" alt="Drag and Drop SSIS Data Flow Task from SSIS Toolbox" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-7934" class="wp-caption-text">Drag and Drop SSIS Data Flow Task from SSIS Toolbox</p></div></li>
<li>Drag and Drop relevant Amazon S3 Source for CSV/JSON/XML File Task from the SSIS Toolbox.
<div id="attachment_6590" style="width: 710px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-add-tasks.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6590" class="wp-image-6590 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-add-tasks.png" alt="Add Amazon S3 Source Tasks" width="700" height="244" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-add-tasks.png 700w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-add-tasks-300x105.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-6590" class="wp-caption-text">Add Amazon S3 Source Tasks</p></div></li>
<li>Create a connection for Amazon S3 Storage Account.
<div id="attachment_6551" style="width: 765px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-select-connection-manager.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6551" class="wp-image-6551 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-select-connection-manager.png" alt="Create Amazon S3 Storage Connection" width="755" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-select-connection-manager.png 755w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-amazon-s3-source-select-connection-manager-300x210.png 300w" sizes="(max-width: 755px) 100vw, 755px" /></a><p id="caption-attachment-6551" class="wp-caption-text">Create Amazon S3 Storage Connection</p></div></li>
<li>Select the relevant single file to read from Amazon S3 Storage in their relevant source of CSV/JSON/XML File Task.
<div id="attachment_6539" style="width: 944px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6539" class="wp-image-6539 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File.png" alt="Select File From Azure Blob Storage" width="934" height="582" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File.png 934w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File-300x187.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File-768x479.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-select-File-436x272.png 436w" sizes="(max-width: 934px) 100vw, 934px" /></a><p id="caption-attachment-6539" class="wp-caption-text">Select File From Amazon S3 Storage</p></div></li>
<li>We can also read the multiple files stored in Amazon S3 Storage using wildcard pattern supported e.g. dbo.tblNames*.csv / dbo.tblNames*.json / dbo.tblNames*.xml in relevant source task
<div id="attachment_6540" style="width: 557px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-set-multiple-Filepath.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6540" class="wp-image-6540 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-set-multiple-Filepath.png" alt="Use wildcard pattern .* to read multiple files data" width="547" height="178" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-set-multiple-Filepath.png 547w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-Azure-Blob-Source-set-multiple-Filepath-300x98.png 300w" sizes="(max-width: 547px) 100vw, 547px" /></a><p id="caption-attachment-6540" class="wp-caption-text">Use wildcard pattern .* to read multiple files data</p></div></li>
<li>We can also read the zip and gzip compressed files also without extracting it in the specific Amazon S3 Source for CSV/JSON/XML File Task.
<div id="attachment_6541" style="width: 698px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-azure-blob-storage-source-read-zip-gzip-compressed-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6541" class="wp-image-6541 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-azure-blob-storage-source-read-zip-gzip-compressed-files.png" alt="Reading zip and gzip compressed files (stream mode)" width="688" height="273" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-azure-blob-storage-source-read-zip-gzip-compressed-files.png 688w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-azure-blob-storage-source-read-zip-gzip-compressed-files-300x119.png 300w" sizes="(max-width: 688px) 100vw, 688px" /></a><p id="caption-attachment-6541" class="wp-caption-text">Reading zip and gzip compressed files (stream mode)</p></div></li>
<li>Finally, we are ready to load this file(s) data into the SQL Server.</li>
</ol>
<h2>Load Amazon S3 files data into SQL Server</h2>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>Above all, in this blog, we learned how to Read Amazon S3 Storage Files in SSIS. We used <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">Amazon S3 Source for CSV file</a>, <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-json-file-source/" target="_blank" rel="noopener">Amazon S3 Source for JSON file</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-xml-file-source/" target="_blank" rel="noopener">Amazon S3 Source for XML file</a> to read the file(s) from Amazon S3 Storage and load data into SQL server. You can <a href="https://zappysys.com/products/ssis-powerpack/">download SSIS PowerPack here</a> to try many other scenarios not discussed in this blog along with 70+ other components.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/#cat_amazon_aws_cloud" target="_blank" rel="noopener">SSIS Amazon S3 Source for CSV/JSON/XML File</a></li>
<li><a href="http://aws.amazon.com/s3/faqs/" target="_blank" rel="noopener">Introduction to Amazon S3 Storage Service</a></li>
<li><a href="https://www.youtube.com/watch?v=zdWPTvtW0E0" target="_blank" rel="noopener">How to Get Your Amazon AWS Access Key &amp; Secret Key</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/read-amazon-storage-s3-files-ssis-csv-json-xml/">Read Amazon S3 Storage Files in SSIS (CSV, JSON, XML)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Import / Export data from Amazon Athena using SSIS</title>
		<link>https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 14 Dec 2017 04:25:21 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[SSIS Amazon S3 CSV Source]]></category>
		<category><![CDATA[SSIS Amazon S3 JSON Source]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[Amazon Athena]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2367</guid>

					<description><![CDATA[<p>Introduction In our previous post we explored unlimited possibilities to call Amazon AWS API using SSIS. Now in this post we will learn how to import / export data from Amazon Athena using SSIS. Amazon Athena is very similar service like Google BigQuery which we documented already.  To read data from Amazon Athena we will use [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/">Import / Export data from Amazon Athena using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png"><img loading="lazy" decoding="async" class="wp-image-2378 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png" alt="" width="147" height="115" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png 510w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo-300x235.png 300w" sizes="(max-width: 147px) 100vw, 147px" /></a>In our previous post we explored unlimited possibilities to <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">call Amazon AWS API using SSIS</a>. Now in this post we will learn how to import / export data from Amazon Athena using SSIS. Amazon Athena is very similar service like <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/" target="_blank" rel="noopener">Google BigQuery which we documented already</a>.  To read data from Amazon Athena we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON / REST API Source</a> which supports excellent JSON parsing capability <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">like this</a>.</p>
<h2></h2>
<h2></h2>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we do hello world demo for calling Amazon AWS API, you will need to make sure following prerequisites are met.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Access to valid AWS credentials (Access Key, Secret Key for your IAM User). <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html" target="_blank" rel="noopener">Click here to learn more</a> about IAM users and Access Key/Secret Key</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>SSIS PowerPack</em></a> is installed. <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">Click here to download</a>.</li>
</ol>
<h2>Steps needed to read data from Amazon Athena</h2>
<p>To read data from Amazon Athena you need to do atleast 3 steps at very high level. Later on this article we will see each step in depth.</p>
<ol>
<li>Call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html" target="_blank" rel="noopener">StartQueryExecution API</a> to send SQL Query (Its Job Style API so this call starts Job)</li>
<li>Keep checking Job Status by calling  <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> (In the response check State field for Status &#8211; We need to look for word SUCCESS)</li>
<li>Once Job is finished it produces CSV file in S3 Bucket (Output Location is supplied in Step-1)</li>
</ol>
<div id="attachment_8355" style="width: 923px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8355" class="size-full wp-image-8355" src="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png" alt="Read Amazon Athena Query output in SSIS (S3 CSV files)" width="913" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png 913w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-768x553.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></a><p id="caption-attachment-8355" class="wp-caption-text">Read Amazon Athena Query output in SSIS (S3 CSV files)</p></div>
<h2>AWS Console &#8211; Athena Query Editor / Configure Output Settings</h2>
<p>Few things you might have to setup before you can call Athena API in SSIS</p>
<ol>
<li>Make sure your IAM user has correct permission (We used existing policies for ease of use but you can use custom policy for precise permission set)</li>
<li>Configure default output location for your Athena queries</li>
</ol>
<div id="attachment_8360" style="width: 996px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8360" class="size-full wp-image-8360" src="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png" alt="Configure IAM user permission to call Amazon Athena API" width="986" height="581" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png 986w, https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy-300x177.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy-768x453.png 768w" sizes="(max-width: 986px) 100vw, 986px" /></a><p id="caption-attachment-8360" class="wp-caption-text">Configure IAM user permission to call Amazon Athena API</p></div>
<div id="attachment_8361" style="width: 837px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8361" class="size-full wp-image-8361" src="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png" alt="Set Athena Query Output Location" width="827" height="454" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png 827w, https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location-300x165.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location-768x422.png 768w" sizes="(max-width: 827px) 100vw, 827px" /></a><p id="caption-attachment-8361" class="wp-caption-text">Set Athena Query Output Location</p></div>
<div id="attachment_8362" style="width: 1080px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8362" class="size-full wp-image-8362" src="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png" alt="Testing Athena Query inside Amazon AWS Console (Query Editor)" width="1070" height="628" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png 1070w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-300x176.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-768x451.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-1024x601.png 1024w" sizes="(max-width: 1070px) 100vw, 1070px" /></a><p id="caption-attachment-8362" class="wp-caption-text">Testing Athena Query inside Amazon AWS Console (Query Editor)</p></div>
<h2>Creating Connection to call Athena API in SSIS</h2>
<p>Any API calls made to Amazon Athena service using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON / REST API Source</a>  or  <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> needs OAuth connection.</p>
<p>For REST API Task configure as below (More details about using REST API Task is in the next section).</p>
<ol>
<li>Drag ZS REST API Task from Control Flow Toolbox<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Double click to edit.</li>
<li>Change Request URL Access Mode to [<strong>Url from Connection</strong>]</li>
<li>Now select <strong>&lt;&lt;New OAuth Connection&gt;&gt;</strong> from connection drop down</li>
<li>On OAuth connection select <strong>Amazon AWS API v4</strong> as Provider</li>
<li>Enter your <strong>Access Key</strong> and <strong>Secret Key</strong></li>
</ol>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">Amazon AWS account must have access to Athena API calls and S3 Bucket </div></div>
<div id="attachment_2370" style="width: 702px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2370" class="size-full wp-image-2370" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png" alt="Create SSIS Connection for Amazon AWS API Call (Athena REST API Example)" width="692" height="651" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png 692w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest-300x282.png 300w" sizes="(max-width: 692px) 100vw, 692px" /></a><p id="caption-attachment-2370" class="wp-caption-text">Create SSIS Connection for Amazon AWS API Call (Athena REST API Example)</p></div>
<h2>Creating Table in Amazon Athena using API call</h2>
<p>For this demo we assume you have already created sample table in Amazon Athena. If you wish to automate creating amazon athena table using SSIS then you need to call <a href="https://docs.aws.amazon.com/athena/latest/ug/create-table.html" target="_blank" rel="noopener">CREATE TABLE</a> DDL command using <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a>.</p>
<ol>
<li>In the previous <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> select OAuth connection (See previous section)</li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.StartQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the Body enter below<br />
<pre class="crayon-plain-tag">{
 "ResultConfiguration": {
 "OutputLocation": "s3://my-bucket/output-files/"
 },
 "QueryString": "create external table tbl01 (CustomerID STRING, CompanyName STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 's3://my-bucket/input-files/';",
 "ClientRequestToken": "{{System::ExecutionInstanceGUID}}"
}</pre>
<strong>Notice:</strong> Rather than using hard coded  DDL SQL Statement we can use variable placeholder (e.g. <pre class="crayon-plain-tag">"QueryString": "{{User::Query,FUN_JSONENCODE}}"</pre>   ). Use <pre class="crayon-plain-tag">FUN_JSONENCODE</pre> to replace new line with \r\n else JSON becomes invalid.</li>
<li>Now click <strong>Test Request / Response</strong>. This will create a new Athena table which we will query in later section.</li>
</ol>
<p>&nbsp;</p>
<p>Notice that in above Body ClientRequestToken is a unique number each time you have to call <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a> to make it simple we used SSIS system variable <strong>System::ExecutionInstanceGUID</strong>. Its unique for each execution. You can also use newid() function from SQL Server and save result to variable if you like.</p>
<p>Here is the screenshot of above Request</p>
<div id="attachment_2368" style="width: 821px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2368" class="size-full wp-image-2368" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png" alt="RESt API Task - Create table in Amazon Athena using SSIS (StartQueryExecution API Call)" width="811" height="760" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png 811w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-300x281.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-768x720.png 768w" sizes="(max-width: 811px) 100vw, 811px" /></a><p id="caption-attachment-2368" class="wp-caption-text">RESt API Task &#8211; Create table in Amazon Athena using SSIS (StartQueryExecution API Call)</p></div>
<p>&nbsp;</p>
<h2>Uploading data for Amazon Athena (Source files)</h2>
<p>Once you have athena table created, we will need some data to query. Loading data to amazon athena table is nothing but upload files to S3. If you noticed we added below line in CREATE TABLE statement in the previous section. This means all source files are located at this S3 location.</p><pre class="crayon-plain-tag">LOCATION 's3://my-bucket/input-files/'</pre><p>
We have written blog post to explain this process (<a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/" target="_blank" rel="noopener">Click Here &#8211; How to load data from SQL server to S3 files</a>).</p>
<h2>Extract data from Amazon Athena using SSIS (Query Athena)</h2>
<p>Now its time to read some data by writing SQL query for Athena data (i.e. S3 files). As we mentioned earlier, reading data from Athena can be done using following steps.</p>
<ol>
<li>Call  <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a>  using REST API Task to execute your Query (It returns you QueryExecutionID). Use same technique as Create Table example. Replace CREATE Table command in body with your SQL Query (New line must be replaced by \r\n in JSON).</li>
<li>Use REST API Task to call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> and configure periodic status check loop (Task keeps waiting until Success or Failure Value not found in Response)</li>
<li>Once data is available read data using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">S3 CSV File Source</a></li>
<li>At last you can clean up query output files or keep it if some other process wants to read it (You can also <a href="https://stackoverflow.com/questions/41413528/amazon-aws-athena-removing-temp-files" target="_blank" rel="noopener">clean up S3 files using bucket retention policy</a> automatically at scheduled interval).</li>
</ol>
<p>Now lets see each step in depth</p>
<h3>Step1-Start Amazon Athena Query Execution</h3>
<p>Now first thing is to execute Athena Query by calling <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a> . Below steps are almost same steps as we saw in section <strong>Creating Table in Amazon Athena using API call</strong></p>
<p>Only part is different here is SQL query is SELECT query rather than CREATE TABLE.</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.StartQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the Body enter below<br />
<pre class="crayon-plain-tag">{
  "ResultConfiguration": {
    "OutputLocation": "s3://my-bucket/output-files/"
  },
  "QueryString": "select * from sampledb.elb_logs\r\nlimit 100000",
  "ClientRequestToken": "{{System::ExecutionInstanceGUID}}"
}</pre>
<strong>Notice:</strong> Rather than using hard coded  SQL Query we can use variable placeholder (e.g. <pre class="crayon-plain-tag">"QueryString": "{{User::Query,FUN_JSONENCODE}}"</pre>   ). Use <pre class="crayon-plain-tag">FUN_JSONENCODE</pre> to replace new line with \r\n else JSON becomes invalid.</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png"><img loading="lazy" decoding="async" class="size-full wp-image-2368" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png" alt="RESt API Task - Create table in Amazon Athena using SSIS (StartQueryExecution API Call)" width="811" height="760" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png 811w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-300x281.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-768x720.png 768w" sizes="(max-width: 811px) 100vw, 811px" /></a></li>
<li>Now go to <strong>Response Settings</strong> Tab and configure below way to extract QueryExecutionId (we will need it later).
<p>Set Extract Type as Json.<br />
Enter Expression as <pre class="crayon-plain-tag">$.QueryExecutionId</pre>
Check Save output to Variable and create new Variable (we can name as QueryExecutionId )</p>
<div id="attachment_8356" style="width: 860px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8356" class="size-full wp-image-8356" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png" alt="Call Athena SQL, Save Amazon Athena QueryExecutionId in SSIS Variable" width="850" height="336" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png 850w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id-300x119.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id-768x304.png 768w" sizes="(max-width: 850px) 100vw, 850px" /></a><p id="caption-attachment-8356" class="wp-caption-text">Call Athena SQL, Save Amazon Athena QueryExecutionId in SSIS Variable</p></div></li>
<li>That&#8217;s it now we can move to next step</li>
</ol>
<p>&nbsp;</p>
<h3>Step2 &#8211; Wait until Athena Query Execution is done</h3>
<p>New version of ZS REST API Task includes <strong>Status check</strong> feature. This feature avoids complex looping logic. Here is how to configure to check Job Status (Wait until Query execution is finished). Steps are almost same as previous section except three things ( Headers, Body and Status Check Tab)</p>
<p>For Status check we will call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> .</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.GetQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the <strong>Body</strong> enter below<br />
<pre class="crayon-plain-tag">{"QueryExecutionId": "{{User::QueryExecutionId}}"}</pre>
<strong>Notice:</strong> Here we have used Variable in the body. This variable we extracted in the previous step. It contains QueryExecution ID for the Job we submitted.</p>
<div id="attachment_8358" style="width: 860px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8358" class="size-full wp-image-8358" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png" alt="SSIS Amazon Athena - Call GetQueryExecution API (Status Check)" width="850" height="556" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png 850w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop-300x196.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop-768x502.png 768w" sizes="(max-width: 850px) 100vw, 850px" /></a><p id="caption-attachment-8358" class="wp-caption-text">SSIS Amazon Athena &#8211; Call GetQueryExecution API (Status Check)</p></div></li>
<li>Now go to <strong>Status Check</strong> Tab and configure below way to implement Status check loop. We want to stop check once status is SUCCESS or FAILED or CANCELLED. If we find FAILED or CANCELLED in State field then we must fail the step with error.
<ol>
<li>Check Enable Status Check</li>
<li>Enter Success Value as <pre class="crayon-plain-tag">SUCCEEDED</pre></li>
<li>Check Fail Task option and enter this regex in the text box <pre class="crayon-plain-tag">FAILED|CANCELLED</pre></li>
<li>In the Interval enter 5 seconds delay after each iteration.</li>
</ol>
</li>
<li>That&#8217;s it. Status check Tab will look like below. Now we can move to next step
<div id="attachment_8357" style="width: 536px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8357" class="size-full wp-image-8357" src="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png" alt="REST API Status check Loop - Keep checking until JOB is done" width="526" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png 526w, https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop-300x223.png 300w" sizes="(max-width: 526px) 100vw, 526px" /></a><p id="caption-attachment-8357" class="wp-caption-text">REST API Status check Loop &#8211; Keep checking until JOB is done</p></div></li>
</ol>
<p>&nbsp;</p>
<h3>Step3-Read data from Athena Query output files (CSV / JSON stored in S3 bucket)</h3>
<p>When you create Athena table you have to specify query output folder and data input location and file format (e.g. CSV, JSON, Avro, ORC, Parquet &#8230;) they can be GZip, Snappy Compressed. Once you execute query it generates CSV file. Zappysys can read CSV, TSV or JSON files using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">S3 CSV File Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-json-file-source/" target="_blank" rel="noopener">S3 JSON File Source</a> connectors. In this section we will use CSV connector to read Athena output files.</p>
<p>Here is how to Athena output data</p>
<ol>
<li>Drag and drop Data flow task from SSIS Toolbox<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click data flow and drag and drop  <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">ZS Amazon S3 CSV File Source</a><br />
<img decoding="async" class="figureimage" title="SSIS Amazon S3 CSV Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-csv-source/ssis-amazon-s3-csv-file-source-drag.png" alt="SSIS Amazon S3 CSV Source - Drag and Drop" /></li>
<li>Double click to configure it.</li>
<li> Click New Connection and configure S3 Connection</li>
<li>Once connection is created, browse to S3 bucket / folder location where Athena outputs files.</li>
<li>Replace file name with variable like below<br />
<pre class="crayon-plain-tag">my-bucket/output-files/{{User::QueryExecutionId}}.csv</pre>
&nbsp;</li>
</ol>
<p>&nbsp;</p>
<div id="attachment_2371" style="width: 1214px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2371" class="size-full wp-image-2371" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png" alt="Reading data from Amazon Athena CSV files (Stored in S3)" width="1204" height="675" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png 1204w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-300x168.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-768x431.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-1024x574.png 1024w" sizes="(max-width: 1204px) 100vw, 1204px" /></a><p id="caption-attachment-2371" class="wp-caption-text">Reading data from Amazon Athena CSV files (Stored in S3)</p></div>
<h2>Putting all together &#8211; Athena Data Extract Example</h2>
<p>Here is final package with all pieces we talked.</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png"><img loading="lazy" decoding="async" class="size-full wp-image-8355" src="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png" alt="Read Amazon Athena Query output in SSIS (S3 CSV files)" width="913" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png 913w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-768x553.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></a></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>You have seen that using ZappySys SSIS PowerPack how quickly you can integrate with Amazon Athena and other AWS Cloud Services.  <a href="https://zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> and try it out by yourself.</p>
<p><strong>Keywords:</strong> Extract data from Amazon Athena | Read from Amazon Athena Query file | Import / Export data from Amazon Athena | Fetch data from Amazon Athena</p>
<p>The post <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/">Import / Export data from Amazon Athena using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
