<?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 JSON Generator Transform Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 22 Oct 2025 22:58:58 +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 JSON Generator Transform Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Pivot CSV Data in SSIS</title>
		<link>https://zappysys.com/blog/pivot-csv-data-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 19 Oct 2019 08:22:53 +0000</pubDate>
				<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8207</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw How to write data into CSV file in SSIS (GZip / Split). Now in this blog, we will see How to Pivot CSV Data in SSIS using CSV Source. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/pivot-csv-data-ssis/">How to Pivot CSV Data in 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/2018/02/ssis-csv-file-source.png" target="_blank" rel="noopener"><img decoding="async" class="wp-image-3102 size-full alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-csv-file-source.png" alt="" width="100" height="100" /></a>In our previous blog we saw <a href="https://zappysys.com/blog/write-data-csv-file-ssis-gzip-split/" target="_blank" rel="noopener">How to write data into CSV file in SSIS (GZip / Split)</a>. Now in this blog, we will see <strong>How to Pivot CSV Data in SSIS using <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">CSV Source</a></strong>. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we also see how make some CSV columns as parent and not consider it in pivot and load it as it is using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> Pivot Option.</p>
<p>In nutshell, this post will focus on how to Pivot CSV Data into multiple columns and rows.</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>How to Pivot CSV Data in SSIS using CSV File Source</h2>
<p>Let´s start with an example. In this SSIS CSV Parser Transform example, we will Parse database column string into multiple columns and rows.</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 fetchpriority="high" 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>Furthermore, drag and drop the CSV Source and Double click on it to configure it.
<div id="attachment_8212" style="width: 701px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8212" class="wp-image-8212 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" alt="Drag and Drop : CSV Source from SSIS Toolbox" width="691" height="357" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png 691w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source-300x155.png 300w" sizes="(max-width: 691px) 100vw, 691px" /></a><p id="caption-attachment-8212" class="wp-caption-text">Drag and Drop : CSV Source from SSIS Toolbox</p></div></li>
<li>Enter the CSV file path and select desire column delimiter most common in CSV is comma and check the First Row as headers and click on preview.
<div id="attachment_8213" style="width: 683px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8213" class="wp-image-8213 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" alt="CSV Source Preview" width="673" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png 673w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview-275x300.png 275w" sizes="(max-width: 673px) 100vw, 673px" /></a><p id="caption-attachment-8213" class="wp-caption-text">CSV Source Preview</p></div></li>
<li>Now, go to Pivot Columns to Rows Tab and checked Enable Pivoting and click on Preview Data to view the data.
<div id="attachment_8214" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8214" class="wp-image-8214 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-768x643.png" alt="CSV Source Pivoted Data Preview" width="720" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-768x643.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-300x251.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview.png 874w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-8214" class="wp-caption-text">CSV Source Pivoted Data Preview</p></div></li>
<li>That&#8217;s it we see how to read data from CSV File and also Pivot the CSV Data using CSV Source.</li>
<li>Now In the next section we will see how to how make some CSV columns as parent and not consider it in pivot and load it as it is.</li>
</ol>
<h2>How make some CSV columns as parent.</h2>
<p>Sometimes you just need to make child columns in to rows and want to leave parent level columns as it is.</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 fetchpriority="high" 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>Secondly, drag and drop the CSV Source and Double click on it to configure it.
<div id="attachment_8212" style="width: 701px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8212" class="wp-image-8212 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" alt="Drag and Drop : CSV Source from SSIS Toolbox" width="691" height="357" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png 691w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source-300x155.png 300w" sizes="(max-width: 691px) 100vw, 691px" /></a><p id="caption-attachment-8212" class="wp-caption-text">Drag and Drop : CSV Source from SSIS Toolbox</p></div></li>
<li>Furthermore, enter the file path and click on preview.
<div id="attachment_8213" style="width: 683px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8213" class="wp-image-8213 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" alt="CSV Source Preview" width="673" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png 673w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview-275x300.png 275w" sizes="(max-width: 673px) 100vw, 673px" /></a><p id="caption-attachment-8213" class="wp-caption-text">CSV Source Preview</p></div></li>
<li>For example if we want to pivot Email and Phone only in pivoting and wants to exclude parent level columns FirstName and LastName as it is.</li>
<li>For that drag and drop JSON Generator Transform and Select Output Mode as <strong>Output One JSON Per Parent Input Row</strong>  and Add Unbound Nested Element and named it as <strong>Persons and click on OK</strong>.
<div id="attachment_8277" style="width: 638px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8277" class="wp-image-8277 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png" alt="JSON Generator Add Unbound Nested Element" width="628" height="624" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png 628w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-300x298.png 300w" sizes="(max-width: 628px) 100vw, 628px" /></a><p id="caption-attachment-8277" class="wp-caption-text">JSON Generator Add Unbound Nested Element</p></div></li>
<li>Now add that two parent level fields FirstName and LastName in the Persons.
<div id="attachment_8278" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8278" class="wp-image-8278 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png" alt="JSON Generator Add Multiple Elements" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8278" class="wp-caption-text">JSON Generator Add Multiple Elements</p></div></li>
<li>Now select Person Element and right click and Add Unbound Nested Element and <strong>named it as Contacts and click on OK</strong>.
<div id="attachment_8279" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8279" class="wp-image-8279 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png" alt="JSON Generator Add Unbound Nested Element" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8279" class="wp-caption-text">JSON Generator Add Unbound Nested Element</p></div></li>
<li>Now add that two child level fields Email and Phone in the Contacts.
<div id="attachment_8280" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8280" class="wp-image-8280 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png" alt="JSON Generator Add Multiple Elements" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8280" class="wp-caption-text">JSON Generator Add Multiple Elements</p></div></li>
<li>Therefore JSON Generator Transform looks like below screen. Now Copy that Sample Preview JSON String to use it in the JSON Parser Transom as sample string.
<div id="attachment_8276" style="width: 743px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8276" class="wp-image-8276 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png" alt="JSON Generator Transform - Sample Data" width="733" height="833" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png 733w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data-264x300.png 264w" sizes="(max-width: 733px) 100vw, 733px" /></a><p id="caption-attachment-8276" class="wp-caption-text">JSON Generator Transform &#8211; Sample Data</p></div></li>
<li>Similarly, drag and drop JSON Parser Transform and select the Input JSON Column and Paste that copied Sample JSON String and select the Contacts filter to read the Child data and click on Include Parent.
<div id="attachment_8281" style="width: 853px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8281" class="wp-image-8281 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png" alt="JSON Parser Transform - Select Filter " width="843" height="650" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png 843w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter-300x231.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter-768x592.png 768w" sizes="(max-width: 843px) 100vw, 843px" /></a><p id="caption-attachment-8281" class="wp-caption-text">JSON Parser Transform &#8211; Select Filter</p></div></li>
<li>Now go to Pivot Columns to Rows Tab and checked the Enable Pivoting and click on the Preview.
<div id="attachment_8282" style="width: 608px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8282" class="wp-image-8282 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png" alt="JSON Parser Transform - Enable Pivoting" width="598" height="656" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png 598w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting-273x300.png 273w" sizes="(max-width: 598px) 100vw, 598px" /></a><p id="caption-attachment-8282" class="wp-caption-text">JSON Parser Transform &#8211; Enable Pivoting</p></div></li>
<li>Finally, we are ready to load this data.
<div id="attachment_8283" style="width: 887px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8283" class="wp-image-8283 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png" alt="CSV Pivoted Data" width="877" height="388" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png 877w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer-300x133.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer-768x340.png 768w" sizes="(max-width: 877px) 100vw, 877px" /></a><p id="caption-attachment-8283" class="wp-caption-text">CSV Pivoted Data</p></div></li>
<li>Let&#8217;s load this data in the SQL Server.</li>
</ol>
<h2><span id="Load_Walmart_API_data_into_SQL_Server">Load Pivoted CSV File data into SQL Server</span></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>After all, we saw you how to read CSV file data, pivot the data and Similarly, using SSIS JSON Generator and Parser Transform Pivot the CSV Data excluding some columns from pivoting.  To explore many other scenarios not discussed in this article download <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here (includes 70+ Components)</a>.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following URL for more information.</p>
<ul>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-csv-source.htm" target="_blank" rel="noopener">CSV Source</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/pivot-csv-data-ssis/">How to Pivot CSV Data in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Write/Read WordPress data using SSIS and REST API</title>
		<link>https://zappysys.com/blog/write-read-wordpress-data-using-ssis-rest-api/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Fri, 26 Apr 2019 23:03:36 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6864</guid>

					<description><![CDATA[<p>Introduction In this new article, we will show how to read WordPress data using REST API. REST API is a very popular software architectural style for Web Services. SSIS is a very popular ETL software used to integrate almost any data (SQL Server, Oracle, Excel, DB2, CSV files, Big Data, Facebook, Gmail, etc). Requirements For this example, we will use a [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/write-read-wordpress-data-using-ssis-rest-api/">Write/Read WordPress data using SSIS and REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this new article, we will show how to read WordPress data using REST API. REST API is a very popular software architectural style for Web Services.<br />
SSIS is a very popular ETL software used to integrate almost any data (SQL Server, Oracle, <a href="https://zappysys.com/products/ssis-powerpack/ssis-excel-file-source/">Excel</a>, DB2, <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/">CSV files</a>, Big Data, <a href="https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/">Facebook</a>, <a href="https://zappysys.com/blog/calling-gmail-rest-api-using-ssis-read-emails/">Gmail</a>, etc).</p>
<h2>Requirements</h2>
<p>For this example, we will use a popular plug-in. The name is ZappySys PowerPack for SSIS which includes some nice generic connectors to REST API. You can download it here:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/download/">ZappySys PowerPack for SSIS Installer</a></li>
<li><a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017">SSDT for Business Intelligence</a></li>
</ul>
<h2>Getting started</h2>
<p>We will be using this <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a> component to make things work:<br />
<div class="su-table su-table-alternate">
<table width="300">
<tbody>
<tr style="line-height: 0px">
<td width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/images/SSIS-PowerPack/ssis-rest-api-web-service-task.png" alt="SSIS REST API Web Service Task" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">SSIS REST API Web Service Task<br />
</a></td>
</tr>
<tr style="line-height: 0px">
<td style="height: 58px" width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/images/SSIS-PowerPack/SSIS-Json-Source-Adapter.png" alt="JSON Source (File, REST API, OData Connector)" width="50" height="50" /></a></td>
<td style="vertical-align: middle;height: 58px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source (File, REST API, OData Connector)</a></td>
</tr>
<tr style="line-height: 0px">
<td style="height: 58px" width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" target="_blank" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-file-destination/ssis-json-file-destination.png" alt="SSIS JSON File Destination (Create JSON File)" width="50" height="50" /></a></td>
<td style="vertical-align: middle;height: 58px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" target="_blank" rel="noopener">SSIS JSON File Destination (Create JSON File)<br />
</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Read WordPress data using SSIS with REST API</h2>
<p>REST API is also the name of one of the ZappySys components. These tools can connect to thousands of REST API Servers. In this example, we will connect to WordPress.</p>
<ol>
<li>First, drag and drop the <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/"><strong>REST API</strong></a> task to the design pane.</li>
<li>Secondly, write the following URL in the REST API task URL:<a href="http://demo.wp-api.org/wp-json/wp/v2/pages"><br />
</a><br />
<pre class="crayon-plain-tag">http://demo.wp-api.org/wp-json/wp/v2/pages</pre>
</li>
<li>After that, press <strong>Test Request/Response.</strong></li>
<li>That URL shows the page&#8217;s information in WordPress. This is a demo API. For more information about the WordPress links, check <a href="https://developer.wordpress.org/rest-api/reference/">here</a>.
<div id="attachment_6874" style="width: 696px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-rest-api-wordpress.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6874" class="size-full wp-image-6874" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-rest-api-wordpress.png" alt="ssis-wordpress" width="686" height="613" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-rest-api-wordpress.png 686w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-rest-api-wordpress-300x268.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-6874" class="wp-caption-text">Call WordPress in SSIS</p></div></li>
<li>Next, you can also check the Tags, Comments, Categories, Posts, Taxonomies, Media. Here you have some examples:
<ul>
<li>To get the tags in WordPress, use this URL:<br />
<pre class="crayon-plain-tag">http://demo.wp-api.org/wp-json/wp/v2/tags</pre>
</li>
<li>In order to read comments in WordPress using SSIS and REST API, use this URL:<br />
<pre class="crayon-plain-tag">http://demo.wp-api.org/wp-json/wp/v2/comments</pre>
</li>
<li>For the categories, use this URL to read WordPress data using SSIS:<br />
<pre class="crayon-plain-tag">http://demo.wp-api.org/wp-json/wp/v2/categories</pre>
</li>
</ul>
</li>
<li>In addition, for your blog, you need to add /wp-json/wp/v2/ and pages, posts or tags in your WordPress URL.</li>
<li>Finally, if you want to save the results, in Response Settings, enable save response content and select the option save to file, and specify a file path:
<div id="attachment_6877" style="width: 696px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-restp-api-wordpress-save-json.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6877" class="wp-image-6877 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-restp-api-wordpress-save-json.png" alt="Wordpress response into file" width="686" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-restp-api-wordpress-save-json.png 686w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-restp-api-wordpress-save-json-300x286.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-6877" class="wp-caption-text">Save response WordPress API</p></div></li>
</ol>
<h2>How to read WordPress data using SSIS and store it into a SQL Server database</h2>
<p>In the next example, we will use the <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a> component. This component is similar to the REST API, but this is used in the Data Flow to save the REST API results in any destination of your preference (SQL Server, PostgreSQL, MongoDB, etc). Also, this example will read WordPress data using SSIS and store it into a SQL Server database.</p>
<ol>
<li>First of all, in the Control flow, drag and drop the Data Flow:
<div style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="Insert Data Flow" width="460" height="155" /><p class="wp-caption-text">Data Flow Task</p></div></li>
<li>Drag and drop the JSON Source in the Data flow with this configuration:
<div id="attachment_6880" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-source-get-rest-api-wordpress.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6880" class="size-full wp-image-6880" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-source-get-rest-api-wordpress.png" alt="SSIS wordpress data" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-source-get-rest-api-wordpress.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-source-get-rest-api-wordpress-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-source-get-rest-api-wordpress-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6880" class="wp-caption-text">JSON Source to WordPress API</p></div></li>
<li>Finally, you can save to an OLEDB Destination to save into a SQL Database:
<div id="attachment_6882" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-to-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6882" class="size-full wp-image-6882" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-to-sql-server.png" alt="From WordPress into SQL Server" width="824" height="718" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-to-sql-server.png 824w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-to-sql-server-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-to-sql-server-768x669.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-6882" class="wp-caption-text">Store WordPress into SQL Server</p></div></li>
</ol>
<h2>How to read WordPress data using SSIS and modify the JSON structure</h2>
<p>Sometimes we need to modify the WordPress JSON output to a custom output in SSIS. We will now use the JSON Generator Transform this time, which is a very powerful tool for this purpose.</p>
<ol>
<li>First of all, we will use the JSON Source connecting to the following<br />
<pre class="crayon-plain-tag">URL: http://demo.wp-api.org/wp-json/wp/v2/categories</pre>
</li>
<li>Secondly, we need to convert the JSON output to the following format:<br />
<pre class="crayon-plain-tag">{
   "id" : 
     {
         "count" : 1474359596826126768,
         "description" : 
          {
            "link" : "xxx"
          }
    }
}</pre>
</li>
<li>Next, we will add an element first:
<div id="attachment_6885" style="width: 744px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-static-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6885" class="size-full wp-image-6885" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-static-value.png" alt="Add custom JSON in SSIS" width="734" height="326" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-static-value.png 734w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-static-value-300x133.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></a><p id="caption-attachment-6885" class="wp-caption-text">SSIS WordPress API</p></div></li>
<li>Also, we will select the id attribute:
<div id="attachment_6942" style="width: 405px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-id-add-attribute.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6942" class="size-full wp-image-6942" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-id-add-attribute.png" alt="SSIS id JSON" width="395" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-id-add-attribute.png 395w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-id-add-attribute-271x300.png 271w" sizes="(max-width: 395px) 100vw, 395px" /></a><p id="caption-attachment-6942" class="wp-caption-text">id attributes SSIS</p></div></li>
<li>In addition, we will add a static element to the id:
<div id="attachment_6944" style="width: 743px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-mapping-add-element.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6944" class="size-full wp-image-6944" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-mapping-add-element.png" alt="Increment an element in JSON with SSIS" width="733" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-mapping-add-element.png 733w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-json-mapping-add-element-300x109.png 300w" sizes="(max-width: 733px) 100vw, 733px" /></a><p id="caption-attachment-6944" class="wp-caption-text">Add JSON element</p></div></li>
<li>Furthermore, we will add the count element.
<div id="attachment_6943" style="width: 405px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-count.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6943" class="size-full wp-image-6943" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-count.png" alt="SSIS generate JOSN" width="395" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-count.png 395w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-count-271x300.png 271w" sizes="(max-width: 395px) 100vw, 395px" /></a><p id="caption-attachment-6943" class="wp-caption-text">Add element in JSON with SSIS</p></div></li>
<li>Finally, repeat the same process for the description and link. The JSON structure will be the following:</li>
</ol>
<h2>How to read WordPress data using SSIS and use pagination</h2>
<p>If it is a lot of data in REST API, pagination allows showing the results in pages. Let&#8217;s take a look at it.</p>
<ol>
<li>First of all, we will use page 2. To do it, we will use the following URL in the JSON Source task in the data flow:<br />
<pre class="crayon-plain-tag">http://demo.wp-api.org/wp-json/wp/v2/posts?per_page=2</pre>
<div id="attachment_6947" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6947" class="size-full wp-image-6947" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-pagination.png" alt="Wordpress Pagination SSIS" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-pagination.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-pagination-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-api-pagination-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6947" class="wp-caption-text">SSIS URL pagination REST API</p></div></li>
<li>Secondly, there is a pagination tab that can be used to get the data using pagination. For more information about pagination, refer to our ZappySys <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">Pagination article related</a>.
<div id="attachment_6949" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-per-page-pagination-wordpress.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6949" class="size-full wp-image-6949" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-per-page-pagination-wordpress.png" alt="Pagination handled in SSIS for WordPress" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-per-page-pagination-wordpress.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-per-page-pagination-wordpress-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-per-page-pagination-wordpress-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6949" class="wp-caption-text">SSIS pagination in SSIS</p></div></li>
</ol>
<h2>How to write WordPress data using SSIS</h2>
<ol>
<li>In order to write WordPress data using SSIS, we will use the REST API task with the following URL:<br />
<pre class="crayon-plain-tag">POST http://demo.wp-api.org/wp-json/wp/v2/posts/</pre>
</li>
<li>Secondly, we have the post with id equal to 2 and we will use the body request as follows:<a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-write-data.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-6951" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-write-data.png" alt="" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-write-data.png 800w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-write-data-300x245.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-wordpress-write-data-768x628.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></a></li>
</ol>
<h2>Conclusion</h2>
<p>To conclude, in this article, we learned how to write and read WordPress data using SSIS. In addition, we learned also how to get pagination and how to change the format of the JSON results. If you want to try it yourself, do not hesitate to <a href="https://zappysys.com/products/ssis-powerpack/download/">download ZappySys PowerPack</a>!</p>
<h2>References</h2>
<p>Finally, for more information about how to read WordPress Data using SSIS, refer to these links:</p>
<ul>
<li><a href="https://developer.wordpress.org/rest-api/reference/">REST API Handbook</a></li>
<li><a href="https://www.youtube.com/watch?v=rGObWtjxGBc&amp;t=296s">WordPress REST API Tutorial (Real Examples)</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/write-read-wordpress-data-using-ssis-rest-api/">Write/Read WordPress data using SSIS and REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to batch REST API requests in SSIS (Bulk Operation)</title>
		<link>https://zappysys.com/blog/batch-rest-api-requests-ssis-bulk-operation/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 06 Feb 2019 21:32:43 +0000</pubDate>
				<category><![CDATA[SSIS CSV Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS Script Component]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[SSIS XML Generator Transform]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6305</guid>

					<description><![CDATA[<p>Introduction In our previous article we saw how to POST data to REST API using few different ways. Now let&#8217;s go one step further and discuss another common scenario to batch REST API requests in SSIS. For efficient data transfer many API provides you to submit multiple records in a single request. In this article [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/batch-rest-api-requests-ssis-bulk-operation/">How to batch REST API requests in SSIS (Bulk Operation)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous article we saw <a href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">how to POST data to REST API</a> using few different ways. Now let&#8217;s go one step further and discuss another common scenario to batch REST API requests in SSIS. For efficient data transfer many API provides you to submit multiple records in a single request. In this article we will look at few ways to batch our requests using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> and  <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API destination</a>.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Method 1 &#8211; Batch records using SSIS JSON / XML Generator Transform</h2>
<p>First let&#8217;s look at common way to group multiple records and generate single JSON or XML document for desired batch size. We will also see another technique where you can assign Unique BatchID to each document.</p>
<p>For example below screenshot shows how to product one JSON document for every 10 input rows. We have also use BatchID column on the root level. This will use use BatchID from first row of that batch. You can use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-generator-transform/" target="_blank" rel="noopener">XML Generator Transform</a> if you like to produce XML Document rather than JSON.</p>
<p>To generate Unique BatchID you can use function like newid() in SQL Server.</p><pre class="crayon-plain-tag">SELECT newid() as BatchID,CustomerID,CompanyName FROM Customers</pre><p>
<div id="attachment_6306" style="width: 1115px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6306" class="size-full wp-image-6306" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting.png" alt="Using SSIS JSON Generator Transform with Batch Option (Multiple Records in a single document)" width="1105" height="865" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting.png 1105w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting-300x235.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting-768x601.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting-1024x802.png 1024w" sizes="(max-width: 1105px) 100vw, 1105px" /></a><p id="caption-attachment-6306" class="wp-caption-text">Using SSIS JSON Generator Transform with Batch Option (Multiple Records in a single document)</p></div>
<p>&nbsp;</p>
<p>Here if full flow to batch your JSON Requests and Submit to REST API.</p>
<div id="attachment_6307" style="width: 671px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-post-data-rest-api-in-batch.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6307" class="size-full wp-image-6307" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-post-data-rest-api-in-batch.png" alt="POST data to REST API in Bulk Mode (Batch multiple rows)" width="661" height="785" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-post-data-rest-api-in-batch.png 661w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-post-data-rest-api-in-batch-253x300.png 253w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-6307" class="wp-caption-text">POST data to REST API in Bulk Mode (Batch multiple rows)</p></div>
<p>&nbsp;</p>
<h2>Method 2 &#8211; Using SSIS Web API destination Batch Mode with Header / Footer</h2>
<p>Another method of batching is use Web API destination and turn on Batch mode.  You can <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">use Fiddler</a> to debug your web requests incase you are not sure how its generating and sending POST requests after this setting.</p>
<div id="attachment_2616" style="width: 919px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2616" class="size-full wp-image-2616" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png" alt="Configure SSIS Web API Destination for Bulk API call (Smartsheet REST API - Insert multiple rows)" width="909" height="445" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png 909w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination-300x147.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination-768x376.png 768w" sizes="(max-width: 909px) 100vw, 909px" /></a><p id="caption-attachment-2616" class="wp-caption-text">Configure SSIS Web API Destination for Bulk API call (Insert multiple rows)</p></div>
<h2>Method 3 &#8211; Batch CSV records using CSV Generator Transform</h2>
<p>So far we looked at how to batch JSON and XML format. Now let&#8217;s look at scenario where you have to POST CSV formatted data to REST API endpoint.</p>
<p>Assume that you have an API endpoint where you can submit data in multiple batches. Also you have few additional requirements</p>
<ol>
<li>First row of First batch must have column names (any other batch must not contains CSV Header)</li>
<li>In each Batch we want to submit maximum 5 rows as per API call</li>
<li>Each batch must contain Unique Batch Number in URL</li>
</ol>
<p>Here is high level flow.</p>
<div id="attachment_6333" style="width: 1148px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6333" class="size-full wp-image-6333" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting.png" alt="Generate CSV using Batch Setting , Send data to REST API in multiple batches, Debug REST API in Fiddler" width="1138" height="508" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting.png 1138w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting-300x134.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting-768x343.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-csv-using-output-in-batch-setting-1024x457.png 1024w" sizes="(max-width: 1138px) 100vw, 1138px" /></a><p id="caption-attachment-6333" class="wp-caption-text">Generate CSV using Batch Setting , Send data to REST API in multiple batches, Debug REST API in Fiddler</p></div>
<h3>Include CSV Header in First Batch Only</h3>
<p>Now let&#8217;s break down the problem and find out how to do. First problem is we need to include CSV Header only in First batch. To achieve this we use old school trick where we output column names as data row&#8230; and when we generate CSV in the next section we will turn off Column Headers option.</p>
<p>If you are consuming records from SQL Server or any other RDBMS you can write following style source query. If you don&#8217;t use relational source then use native UNION Transform in SSIS.</p><pre class="crayon-plain-tag">select 'CustomerID' as Column1, 'OrderID' as Column2
UNION ALL
select top 12 cast(CustomerID as varchar(1000)), cast(OrderID as varchar(1000)) from Invoices</pre><p>
<h3>Batch records and output CSV data</h3>
<p>Now next step would be to generate CSV data but in batches&#8230; so in our example we have to output size of 5 rows per batch. For this perform the following steps</p>
<ol>
<li>Drag ZS CSV Generator Transform (Included in <strong>v2.8</strong> and Higher)</li>
<li>Connect source to CSV Generator Transform</li>
<li>Now before we edit in UI mode, <strong>right click</strong> and select <strong>Properties</strong>. Change following 3 properties  (You can also change QuoteAroundValue and Dimiliter if needed). In future version batch setting will be visible in UI mode too.
<ol>
<li>ArrayBatchSize  = yourbatchsize (in our case it was just 5 rows per batch)</li>
<li>OutputMode = SingleFileFormat</li>
<li>FirstRowsHasColumnNames  =False</li>
</ol>
</li>
<li>Now double click to configure ZS Generator Output</li>
<li>Right click on Mappings folder node and Add Elements &gt; Select Multiple Columns  &gt; Check columns you like to output</li>
<li>Click OK to Save UI</li>
</ol>
<div id="attachment_6336" style="width: 611px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-csv-generator-output-data-in-batch.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6336" class="size-full wp-image-6336" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-csv-generator-output-data-in-batch.png" alt="Generate CSV data in SSIS (Batch Output Setting)" width="601" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-csv-generator-output-data-in-batch.png 601w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-csv-generator-output-data-in-batch-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-csv-generator-output-data-in-batch-300x300.png 300w" sizes="(max-width: 601px) 100vw, 601px" /></a><p id="caption-attachment-6336" class="wp-caption-text">Generate CSV data in SSIS (Batch Output Setting)</p></div>
<h3>Generate unique URL with Batch using Script Component</h3>
<p>Now next task we have to achieve is generate Unique Batch Number. Put that Batch ID in URL like below&#8230;</p><pre class="crayon-plain-tag">http://httpbin.org/post?batch=0
http://httpbin.org/post?batch=1
http://httpbin.org/post?batch=2
.....</pre><p>
<ol>
<li>For this drag SSIS Script Component and select Transformation Mode</li>
<li>Now go to <strong>Inputs and Outputs</strong> tab &gt; Select <strong>Output Columns</strong> &gt; Click <strong>Add Column</strong> &gt; Name it as <strong>URL</strong> &gt; Configure <strong>DataType</strong> as <strong>DT_WSTR</strong> , <strong>Length</strong> = 500</li>
<li>Now got Script Tab and Click Edit. Remove old code and enter following code (Assuming You selected C#). This code will generate new URL with Unique batch ID each time. You can use this same technique to generate Unique row number too (in that case rather than DT_WSTR type you can use DT_I4 type)</p><pre class="crayon-plain-tag">[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
    private static int _batch;
    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        Row.Url = string.Format("http://httpbin.org/post?batch={0}",_batch);
        //If you have to send GUID rather than Integer for Batch ID then use below code
        //Row.Url = string.Format("http://httpbin.org/post?batch={0}",System.Guid.NewGuid());

        _batch = _batch+1;
    }
}</pre><p>
</li>
<li>Click OK to Save script.</li>
</ol>
<div id="attachment_6334" style="width: 681px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-script-component-unique-row-number-output-new-column.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6334" class="size-full wp-image-6334" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-script-component-unique-row-number-output-new-column.png" alt="Output Unique URL or Number using SSIS Script Transform" width="671" height="768" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-script-component-unique-row-number-output-new-column.png 671w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-script-component-unique-row-number-output-new-column-262x300.png 262w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-6334" class="wp-caption-text">Output Unique URL or Number using SSIS Script Transform</p></div>
<h3>Configure Web API Destination to POST CSV Data</h3>
<p>Now final step is to configure SSIS Web API Destination to POST CSV data to API.</p>
<ol>
<li>Drag ZS Web API Destination and connect Source Transform to Web API destination.</li>
<li>Double click to configure</li>
<li>Select Connection Manager</li>
<li>Once connection setup, select Input Column for URL ( This will be same column from Script Transform)</li>
<li>Select column for Body (e.g. ZS_CSV_OUT)</li>
<li>Click OK to save</li>
</ol>
<div id="attachment_6335" style="width: 739px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-configure-web-api-destination-post-csv-data-in-batch.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6335" class="size-full wp-image-6335" src="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-configure-web-api-destination-post-csv-data-in-batch.png" alt="POST data to REST API in multiple batches using SSIS Web API destination" width="729" height="764" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-configure-web-api-destination-post-csv-data-in-batch.png 729w, https://zappysys.com/blog/wp-content/uploads/2019/02/ssis-configure-web-api-destination-post-csv-data-in-batch-286x300.png 286w" sizes="(max-width: 729px) 100vw, 729px" /></a><p id="caption-attachment-6335" class="wp-caption-text">POST data to REST API in multiple batches using SSIS Web API destination</p></div>
<h2>Debug Web API Requests using Fiddler</h2>
<p>Now we ready to run entire flow. Once you execute data flow, observe Input rows before CSV Generator Transform and after. CSV Generator transform must produce less rows before we now grouping multiple rows in a single batch.</p>
<p>Another important aspect to play with API request is to debug it, We recommend you to to look at <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">this article about using Fiddler to debug web requests</a>.</p>
<h2>Download Sample Package</h2>
<p>Here is the <a href="https://zappysys.com/blog/wp-content/uploads/2019/02/RestAPI_Batch.zip">Sample SSIS Package (2012 format) &#8211; Rest API_Batching</a></p>
<h2>Conclusion</h2>
<p>In this post, we saw how easy it is to handle complex REST API  / CSV /JSON / XML operations in SSIS. We configured REST API POST Operation using Batching Method. Hope this post helps you to achieve your API integration without coding.  Feel free to <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">download SSIS PowerPack</a> and try many other components not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/batch-rest-api-requests-ssis-bulk-operation/">How to batch REST API requests in SSIS (Bulk Operation)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read / write data in Google BigQuery using SSIS</title>
		<link>https://zappysys.com/blog/get-data-google-bigquery-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sun, 16 Jul 2017 01:10:44 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google BigQuery]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis web api destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1563</guid>

					<description><![CDATA[<p>Introduction Google BigQuery is a fully managed Big Data platform to run queries against large scale data. In this article you will learn how to integrate Google BigQuery data into Microsoft SQL Server using SSIS. We will leverage highly flexible JSON based REST API Connector and OAuth Connection to import / export data from Google [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<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;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-bigquery-connector/">API Connector for BigQuery Online</a> which makes it much simpler to <strong>Read/Write BigQuery Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<p style="text-align: left;"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1959" src="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png" alt="Google BigQuery API Integration" width="91" height="91" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png 257w" sizes="(max-width: 91px) 100vw, 91px" /></a><a href="https://cloud.google.com/bigquery/" target="_blank" rel="noopener">Google BigQuery</a> is a fully managed <strong>Big Data platform</strong> to run queries against large scale data. In this article you will learn how to integrate <strong>Google BigQuery</strong> data into <strong>Microsoft SQL Server</strong> using <strong>SSIS</strong>. We will leverage highly flexible <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">JSON based REST API Connector</a> and <strong>OAuth Connection</strong> to import / export data from <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/" target="_blank" rel="noopener">Google BigQuery API</a> just in a few clicks.</p>
<p style="text-align: left;">If you are looking for a similar product inside Amazon AWS Cloud then <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/" target="_blank" rel="noopener">check an article about Amazon Athena</a>.</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we look into a Step-By-Step section to extract and load data from BigQuery to SQL Server let&#8217;s make sure you meet the following requirements:</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><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download a FREE trial.</li>
<li>You have basic familiarity with REST API concepts and Google BigQuery API. This post uses <a href="https://cloud.google.com/bigquery/public-data/" target="_blank" rel="noopener">free Public Dataset</a> to query BigQuery table so <em>no billing</em> is required to get your hands dirty 🙂 However, if you like to query your own dataset then make sure you have at least one BigQuery dataset and one table with some sample data created (this part <em>does require</em> billing enabled). Read a <a href="https://cloud.google.com/bigquery/quickstart-web-ui" target="_blank" rel="noopener">Google Quickstart article</a> for more information on how to create a new BigQuery dataset and a table.</li>
</ol>
<h2>Understanding Google BigQuery Object Heirarchy</h2>
<p>Google BigQuery has 3 main concepts below.</p>
<ul style="list-style-type: circle;">
<li>Project
<ul style="list-style-type: circle;">
<li>Dataset
<ul style="list-style-type: circle;">
<li>Table
<ul style="list-style-type: circle;">
<li>Query requests (each query creates a unique JobID &#8211; valid for 24 hours from which you can read data)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>So in order to create BigQuery table you always need Project and then Dataset under that project. You can group objects around Project / Datasets. When you query you can supply fully qualified name of your table in FROM clause (e.g. <pre class="crayon-plain-tag">select count(*) from `bigquery-public-data.usa_names.usa_1910_2013`</pre>  Here <strong>bigquery-public-data</strong> is project name, <strong>usa_names</strong> is dataset and <strong>usa_1910_2013</strong>  is table). So lets get started with Read operation first and then we will cover write operation. For Read operation we will use public dataset so we can quickly show you demo without too many steps but later we will cover how to automate create / delete of Dataset / Tables using API calls.</p>
<p>So let&#8217;s get started.</p>
<h2>Read data from Google BigQuery using SSIS</h2>
<p>Basically you can query Google BigQuery data in two ways: In this article we will not cover 2nd method.</p>
<ul>
<li><strong>Method-1</strong>: Query data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method in BigQuery API</a>. Use it if you expect to get a result in a fairly short amount of time. This API method generates a temp table which gets deleted after 24 hours. You can read data within that time frame using newly created <em>JobId</em> reference.<br />
<div class="su-note"  style="border-color:#e5dd9d;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:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> If you have records that sum up to more than 10MB of data or ~10,000 rows (assuming 1 row uses 1KB of data) then you need to proceed with two-step process as explained below.</div></div></li>
<li><strong>Method-2</strong>: Export SQL query result using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method in BigQuery API</a>. Use this method if you expect a query to take a long time to finish.</li>
</ul>
<p>Now let&#8217;s see how to query Google BigQuery data using SSIS 🙂</p>
<h3>Create Google API Project and Register OAuth App</h3>
<p>To use any <a href="https://developers.google.com/apis-explorer/#p/" target="_blank" rel="noopener">Google API</a> firstly you have to finish two tasks:</p>
<ol>
<li><a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Create Google API Project</a> and obtain projectId (see next section).</li>
<li><a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></li>
<li>Register your own Google OAuth App and obtain <strong>ClientId</strong> and <strong>Client Secret</strong>.</li>
</ol>
<p>Check step-by-step instructions on <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to create Google API Project and create OAuth App for Google</a>. During instructions make sure you enable BigQuery API (screenshots may differ).</p>
<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;">NOTE: For BigQuery API you must use custom app option on OAuth connection. Google used to allow Default App but recent policy changes requires BigQuery to use Custom App to obtain your own ClientId and Client Secret (Some old Screenshots may use Default App for time being so please adjust your settings to use Custom App)</div></div>
<h3>Get Google API Project ID</h3>
<p>Once you have Google API Project created you can grab <a href="https://console.cloud.google.com/project?_ga=1.106484547.1991223081.1500069328">Project ID</a> (see screenshot below). You will need Project ID in the next step when building API URL.</p>
<div id="attachment_1567" style="width: 583px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1567" class="size-full wp-image-1567" src="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" alt="How to find Google API Project ID" width="573" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png 573w, https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id-300x198.png 300w" sizes="(max-width: 573px) 100vw, 573px" /></a><p id="caption-attachment-1567" class="wp-caption-text">How to find Google API Project ID?</p></div>
<h3>Configure OAuth Connection for Google BigQuery API</h3>
<p>In order to call most of Google APIs you will need an OAuth App. If you want to use your own app then refer to <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to register Google OAuth Application (Get ClientID and ClientSecret)</a> article. For simplicity we will use <em>Default OAuth App</em>:</p>
<ol style="margin-left: 0;">
<li>Right click inside Connection Managers area and click &#8220;New Connection&#8230;&#8221;</li>
<li>From the connection type list select &#8220;ZS-OAUTH&#8221; connection type.
<div id="attachment_1569" style="width: 687px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1569" class="size-full wp-image-1569" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>For OAuth Provider select &#8220;Google&#8221;.</li>
<li>For OAuth App type options leave &#8220;Use Default OAuth App&#8221; selected. If you <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">created custom OAuth App</a> then you would need to select &#8220;Use Custom OAuth App&#8221; option.</li>
<li>For Scopes enter or select the following URLs (URL is just a permission name). Each URL must be in a separate line. For demo purposes we use only the first 3 scopes but we included a few more in case you like to test API in depth with a different permission set:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/bigquery.insertdata
https://www.googleapis.com/auth/devstorage.full_control
https://www.googleapis.com/auth/devstorage.read_only
https://www.googleapis.com/auth/devstorage.read_write</pre>
</li>
<li>Click Generate Token. Login using correct account if needed and then you will be prompted to click &#8220;Approve&#8221; OAuth App.</li>
<li>Once you click OK on the login screen you will see new tokens populated on the connection screen.</li>
<li>Click Test to make sure connection / tokens are valid and then click OK to save the connection.<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;"><strong>NOTE:</strong> Below screenshot uses Default App but we recommend you to to use Custom OAuth App (Your own Clientid / secret &#8211; Obtained in previous section)</div></div>
<div id="attachment_1568" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1568" class="size-full wp-image-1568" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png" alt="Create SSIS OAuth API Connection for Google BigQuery API" width="675" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection-300x291.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1568" class="wp-caption-text">Create SSIS OAuth API Connection for Google BigQuery API</p></div></li>
</ol>
<h3>Start BigQuery Job and get JobId (Submit Query)</h3>
<p>Once you have SSIS OAuth connection created for BigQuery API it&#8217;s time to read data from BigQuery. So, basically, there are two ways you can read BigQuery data: using <em>query </em>or <em>insert </em>method. For demo purposes we will use <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method</a>. If you want fire complex queries which can run for many minutes then refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method</a>.</p>
<p>If you are expecting more than 10MB of data (~10K records) then you have to split data extract in two steps:</p>
<ol>
<li>Step-1 : Call <em>jobs/query</em> method using REST API Task to submit SQL query. This steps returns <strong>jobComplete: true</strong> if supplied query execution is done within timeoutMs parameter you included. By default its 10 seconds so if your query is going to take longer than 10 seconds then its good idea to add bigger timeout that way you dont need <strong>step#2</strong>. Once API call is done you will Get JobId in the response. Save that JobId in a variable for later use. This job result is valid for 24-hours only.</li>
<li>Step-2 <strong>(Optional)</strong> &#8211; You can add another optional <strong>REST API Task</strong> after previous step to Wait until Job is completed. For simplicity, this article will Omit setting up Status Check but its very simple&#8230;.Use below settings
<ol>
<li>Drag new REST API Task from toolbox. Connect it to Step-1 and double click to configure as below.</li>
<li>Select URL From Connection mode,</li>
<li>Select OAuth connection</li>
<li>Enter URL as <strong>https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/jobs/{{User::JobId}}</strong> , Method: <strong>GET</strong></li>
<li>On Response Settings Tab, Select Response Content Type <strong>JSON</strong> and for content filter enter <strong>$.status.state</strong></li>
<li>On Status Check Tab, check Enable Status Check Loop and enter <strong>DONE</strong> in SuccessValue field</li>
<li>Doing this setup will make sure we do not query data until Job Status is DONE (System keeps checking every 5 seconds)</li>
</ol>
</li>
<li>Step-2 : Read Job result using JSON Source in a Data Flow Task.</li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;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:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong> : If you are expecting less than ~10K rows then you can skip this step and just go to the next section &#8211; <a href="#Read_BigQuery_SQL_result_Method1_or_Method2">Read BigQuery SQL result (Method#1 or Method#2)</a>.</div></div>
<p>Now lets see how to configure REST API Task to submit query and extract JobId (which will be used in next section).</p>
<ol style="margin-left: 0;">
<li>In the Control Flow designer drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS REST API Task</a> from the SSIS toolbox.</li>
<li>Double click the task to configure it.</li>
<li>Change Request URL Access Mode to [Url from connection].</li>
<li>From the connection dropdown select OAuth connection created in the previous section.</li>
<li>Enter URL as below (replace YOUR-PROJECT-ID with a valid Project ID obtained in the previous section):<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-PROJECT-ID/queries</pre>
</li>
<li>Select Method as POST.</li>
<li>Enter Body (Request Data) as below (change your query if needed; we used Public dataset for the demo): If you do not specify timeout then default is 10 seconds only. Also in this call we only care about JobID from response so we just added maxResults=10 because in 2nd step we will get all rows by doing pagination.<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000"
}</pre>
To use a <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/" target="_blank" rel="noopener">Standard SQL</a> query instead of <a href="https://cloud.google.com/bigquery/docs/reference/legacy-sql" target="_blank" rel="noopener">Legacy SQL</a>, add <strong>useLegacySql</strong> property and set it to <strong>false</strong>:<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000",
   "useLegacySql": false
}</pre>
For all possible parameters refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method documentation</a>.</p>
<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;"><strong>NOTE:</strong> You can also supply location Parameter in the Body JSON to indicate where job should run. For non EU / US datacenters we suggest you to supply this parameter. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location" target="_blank" rel="noopener">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>.<br />
Example Use Of Location<br />
<pre class="crayon-plain-tag">{ &quot;location&quot;:&quot;us-east1&quot;,&nbsp; &quot;maxResults&quot;: 10, &quot;query&quot;: &quot;SELECT title FROM [bigquery-public-data:samples.wikipedia] LIMIT 10&quot; }</pre>
</div></div></li>
<li>Select Body Content Type as <strong>application/json</strong>.</li>
<li>Click Test Request/Response. If things go well you will see JSON content. Then just <strong>copy JobId from the response</strong> and save for later use:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2213" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png" alt="" width="677" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid-300x216.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a></li>
<li>Now go to Response Settings tab.</li>
<li>Select ContentType=Json.</li>
<li>Enter below expression to extract JobId from the response. You will need this Id to read SQL query output (this JobId is valid for 24 hrs):<br />
<pre class="crayon-plain-tag">$.jobReference.jobId</pre>
</li>
<li>Choose save response content to save to a variable. Select &lt;New Variable&#8230;&gt; option. When prompted give a name to your variable (i.e. vJobId) and for the value field paste JobId copied from the above step:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2214" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png" alt="" width="625" height="531" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png 625w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable-300x255.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a><br />
<div class="su-note"  style="border-color:#e5dd9d;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:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: This JobId expires after 24-hrs so while you are designing a package and not running it then design time value is used for testing/previewing. So make sure your JobId is valid. If needed click Test Request/Response to grab a new JobId and update the variable with a new value so you can preview data without running a full package.</div></div></li>
<li>Click OK to save the UI.</li>
</ol>
<h3>Read BigQuery SQL result (for specified JobID)</h3>
<p>Now let&#8217;s look at how to read data from BigQuery</p>
<p>Configure Google BigQuery Web Request (URL, Method, ContentType, Body etc.)</p>
<ol>
<li>In the Control Flow designer 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 Task and drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source (For API/File)</a> from SSIS toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Double click JSON Source to edit and configure as below</li>
<li>Enter URL as below. Replace <strong>YOUR-API-PROJECT-ID</strong> with the API Project ID obtained in the <a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" target="_blank" rel="noopener">previous section</a>.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?maxResults=10000</pre>
&#8211;OR&#8211; (Use below if your Job ran <strong>outside US / EU data center</strong>)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?location=YOUR_REGION_ID&amp;maxResults=10000</pre>
<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;"><strong>NOTE:</strong> location Parameter indicates the geographic location of the job. This is <span style="text-decoration: underline;"><strong>Required parameter except for US and EU</strong></span>. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>. You can supply same location parameter for first step when you <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">submit the query</a></p>
<p>Failure to supply location parameter for non US /EU users may result in <strong>404 NotFound Error</strong>.<br />
</div></div></li>
<li>Check <strong>Use Credentials</strong> option and select <strong>OAuth Connection Manager</strong> created in the previous section.</li>
<li>For HTTP Request Method select <strong>GET</strong>.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png"><img loading="lazy" decoding="async" class="size-full wp-image-2215" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png" alt="Read data from Google BigQuery from Temp Job result" width="1004" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png 1004w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-300x198.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-768x506.png 768w" sizes="(max-width: 1004px) 100vw, 1004px" /></a></li>
</ol>
<p>Read data from Google BigQuery from Temp Job result</p>
<h4>Configure Filter</h4>
<p>We need to transform a single JSON response into multiple rows so we need to apply a correct filter.</p>
<ol>
<li>On JSON Source go to Filter Options tab.</li>
<li>In the Filter field enter<strong> $.rows[*]</strong> or click [Select Filter] button to browse hierarchy you want to extract.</li>
</ol>
<div id="attachment_1573" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1573" class="wp-image-1573 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png" alt="Select Filter for JSON Response" width="675" height="363" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter-300x161.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1573" class="wp-caption-text">Select Filter for JSON Response</p></div>
<h4>Configure BigQuery API Pagination Settings</h4>
<p>Most of modern APIs usually implement some sort of pagination technique so you get a part of data in each request rather than all in one go. Thus if you want more you can paginate through pages until the last page is reached. You can also read <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Understanding REST API Pagination in SSIS</a> article to learn more about pagination in SSIS.</p>
<p>BigQuery API returns <em>pageToken</em> attribute in response JSON if more data is found for requested query result. You can then pass <em>pageToken</em> in the next URL in this format: <strong>http://my-api-url/?pageToken=xxxxxxxxxx</strong></p>
<p>Now lets configure JSON Source to automate this pagination for us. On JSON Source go to Pagination Tab and enter the following two settings:</p>
<ol>
<li>Set Next Link as <strong>$.pageToken</strong>.</li>
<li>Set Suffix for Next URL as <strong>&amp;pageToken=&lt;%nextlink%&gt;</strong>.</li>
</ol>
<p>See the screenshot below to get more clarity:</p>
<div id="attachment_1572" style="width: 815px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1572" class="size-full wp-image-1572" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png" alt="Configure BigQuery API Pagination on SSIS JSON Source" width="805" height="576" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png 805w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-300x215.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-768x550.png 768w" sizes="(max-width: 805px) 100vw, 805px" /></a><p id="caption-attachment-1572" class="wp-caption-text">Configure BigQuery API Pagination on SSIS JSON Source</p></div>
<h4>Configure Array Transformation</h4>
<p>Now the last thing we have to configure is special 2-dimensional JSON array format used by BigQuery API:</p>
<ol>
<li>On the JSON Source UI go to 2D Array Transformation tab.</li>
<li>Enter the following settings:
<ol>
<li>For Transformation Type select <strong>Transform complex 2-dimensional array</strong>.</li>
<li>For Column Name filter enter <strong>$.schema.fields[*].name</strong>.</li>
<li>For Row Values Filter enter <strong>$.f[*].v</strong>.</li>
</ol>
</li>
</ol>
<div id="attachment_1575" style="width: 819px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1575" class="size-full wp-image-1575" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png" alt="JSON Array Transformation Options" width="809" height="317" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png 809w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-300x118.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-768x301.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-1575" class="wp-caption-text">JSON Array Transformation Options</p></div>
<h4>Preview Data and Save UI</h4>
<p>That&#8217;s it click Preview to see some data. If you entered sample JobID for your User::vJobID variable then you will see some data. In the next section we will see how to load Google BigQuery data into SQL Server. You can click Columns Tab to review Metadata.</p>
<p>Click OK to save UI and generate Metadata.</p>
<p>&nbsp;</p>
<h3>Configure Target &#8211; Load Google BigQuery data into SQL Server</h3>
<p>Now you can connect your JSON Source to any target such as ZS Trash Destination or a real database destination such as OLEDB Destination.</p>
<p>If you wish to dump data from Google BigQuery to a SQL Server table then just perform the following steps:</p>
<ol>
<li>Drag and drop OLEDB Destination from SSIS Toolbox. Rename it to something like SQL Server Table.</li>
<li>Double click on OLEDB Destination.</li>
<li>Click New to create a new connection &gt; Configure connection &gt; Click OK.</li>
<li>Click on New to create a new table &gt; Rename default table name &gt; Click OK.</li>
<li>Click on Mappings tab and click OK to save UI with default mappings.</li>
</ol>
<div id="attachment_1580" style="width: 918px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1580" class="size-full wp-image-1580" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png" alt="Configure SSIS OLEDB Destination - Google BigQuery to SQL Server Import" width="908" height="558" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png 908w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-300x184.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-768x472.png 768w" sizes="(max-width: 908px) 100vw, 908px" /></a><p id="caption-attachment-1580" class="wp-caption-text">Configure SSIS OLEDB Destination &#8211; Google BigQuery to SQL Server Import</p></div>
<h3>Execute Package &#8211; Loading BigQuery data into SQL Server</h3>
<div id="attachment_1578" style="width: 596px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1578" class="size-full wp-image-1578" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png" alt="SSIS Package Execution - Loading Google BigQuery Data into SQL Server" width="586" height="296" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png 586w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver-300x152.png 300w" sizes="(max-width: 586px) 100vw, 586px" /></a><p id="caption-attachment-1578" class="wp-caption-text">SSIS Package Execution &#8211;<br />Loading Google BigQuery Data into SQL Server</p></div>
<h2>Create / Delete Google BigQuery Dataset using API call</h2>
<p>As we mentioned before, you need dataset before you can create a table. Most common way to create dataset is via User Interface but what if you like to automate from your SSIS Package or other workflow? Here is how you can create or delete. Basically you can use REST API Task to send CREATE or DROP command for Dataset object</p>
<h3><strong>Create Google Dataset</strong></h3>
<p>To create dataset configure REST API Task using below settings (We will <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert" target="_blank" rel="noopener">call this API</a>)</p>
<ol>
<li>Drag REST API Task from 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>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/datasets</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below (change YOUR_DATASET_NAME &#8211; e.g. TestDataset )<br />
<pre class="crayon-plain-tag">{"datasetReference": { "datasetId": "YOUR_DATASET_NAME", "projectId": "{{User::ProjectId}}"} }</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Dataset already exists then you can go to Error Handling Tab (See next section for screenshot) and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<h3>Delete Google BigQuery Dataset</h3>
<p>For deleing dataset you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Create / Delete Google BigQuery Table using API call</h2>
<p>Now let&#8217;s look at how to create /drop Table in Google BigQuery using API calls.</p>
<h3>Create Google BigQuery Table</h3>
<p>To send <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#:~:text=%20%20%201%20Open%20the%20BigQuery%20web,table%20appears%20in%20the%20resources%20pane.%20More%20" target="_blank" rel="noopener">CREATE TABLE  SQL statement (DDL)</a> we have to use same approach as we send normal SQL Query <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">using this API call</a>. So notice we used Standard SQL for this call by supplying  <strong>useLegacySql: false</strong> . DDL Statement must be all in one line</p><pre class="crayon-plain-tag">POST https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries

Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000 
}</pre><p>
To create dataset configure REST API Task using below settings</p>
<ol>
<li>Drag REST API Task from 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>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000
}</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Table exists then you can go to enable Error Handling Tab and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<div id="attachment_8986" style="width: 1008px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8986" class="size-full wp-image-8986" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png" alt="Create Google BigQuery Table - API Call (Continue On Error Setting - Skip CREATE if Table / Dataset Already Exists)" width="998" height="692" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png 998w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-300x208.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-768x533.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></a><p id="caption-attachment-8986" class="wp-caption-text">Create Google BigQuery Table &#8211; API Call (Continue On Error Setting &#8211; Skip CREATE if Table / Dataset Already Exists)</p></div>
<h3>Delete Google BigQuery Table</h3>
<p>For deleing table you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Write data to Google BigQuery using SSIS &#8211; 1 Million row insert test (FAST)</h2>
<p>Now let&#8217;s look at how easy it is to import data into Google BigQuery using SSIS. We will use the same OAuth connection we created before. To learn more about inserting data into BigQuery check <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll"><i>tabledata/insertAll </i>method documentation</a>.</p>
<h3>Make sure billing is enabled</h3>
<p>Make sure that billing is enabled for your Google Cloud project. <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to confirm billing is enabled for your project</a>.</p>
<p>Streaming is not available via the <a href="https://cloud.google.com/bigquery/pricing#free-tier">free tier</a>. If you attempt to use streaming without enabling billing, you receive the following error: <code translate="no" dir="ltr">BigQuery: Streaming insert is not allowed in the free tier.</code></p>
<p>As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call (Write  demo).</p>
<h3>Configure OAuth Connection / Permissions</h3>
<p>If you want to perform data insert operation in BigQuery using API calls then include the following scopes in your OAuth Connection Manager and generate a token (see our first section of this article &#8211; We already included scopes for Write operation but incase you didnt do then regenerate token with below scopes):</p><pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/bigquery.insertdata</pre><p>
<h3>Create BigQuery Dataset (From UI)</h3>
<p>For this demo first create a test dataset and one table under it like shown below (<em>billing must be enabled on your Google API Project</em>). To do that go to <a href="https://bigquery.cloud.google.com/welcome" target="_blank" rel="noopener">https://bigquery.cloud.google.com/welcome</a> and configure them:</p>
<div class="su-note"  style="border-color:#e5dd9d;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:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> BigQuery now provides a <a href="https://cloud.google.com/bigquery/docs/sandbox">sandbox</a> if you do not want to provide a credit card or enable billing for your project. The steps in this topic work for a project whether or not your project has billing enabled. If you optionally want to enable billing, see <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to enable billing</a>. There are some restriction on Sandbox mode (Write API calls will fail &#8211; Check Common Errors section later this article)</div></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png"><img loading="lazy" decoding="async" class="size-full wp-image-2354" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png" alt="Create sample dataset and table for Google BigQuery Load" width="715" height="599" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png 715w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination-300x251.png 300w" sizes="(max-width: 715px) 100vw, 715px" /></a></p>
<h3>Insert data into BigQuery using API call</h3>
<p>And here is a REST API example to insert data into a BigQuery Table:</p>
<p><strong>Request URL:</strong></p><pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre><p>
<strong>Request Headers:</strong></p><pre class="crayon-plain-tag">Authorization: Bearer ya29.Gl0cBxxxxxxxxxxxxxxxxxxuEIhJIEnxE6GsQPHI
Content-Type: application/json</pre><p>
<strong>Request Body:</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre><p>
<h3></h3>
<p>Here is our data flow setup to achive very high throughput for Google BigQuery Data Load. We will show you how to insert one million rows in Google BigQuery in less than a minute based on below setup. We will use Multi Threading option and New Compression Option (Added in v3.1.4)</p>
<ol>
<li>Dummy Data Source &#8211; Generate sample records</li>
<li>JSON Generator Transform &#8211; Generates JSON documents to send as POST request for above /insertAll API call.</li>
<li>Web API destination  &#8211; Call /insertAll API call to submit our data to BigQuery</li>
<li><strong>(Optional)</strong> JSON Parser Transform &#8211; Parse Error Message for any response</li>
<li><strong>(Optional)</strong> Trash Destination &#8211; Save any errors to text file for review</li>
</ol>
<div id="attachment_8973" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8973" class="size-full wp-image-8973" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png" alt="Google BigQuery Data Load Demo in SSIS - 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)" width="900" height="724" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-300x241.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-768x618.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-8973" class="wp-caption-text">Google BigQuery Data Load Demo in SSIS &#8211; 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)</p></div>
<p>&nbsp;</p>
<h3>Configure SSIS JSON Generator &#8211; Generate JSON for BigQuery Table Insert</h3>
<p>Now let&#8217;s see how to build an HTTP request with JSON body and send it to BigQuery:</p>
<ol style="margin-left: 0;">
<li>Drag Data Flow Task and double click on it.<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>Drag and configure your Source (for this demo we use Dummy Data Source with Customer Template). See previous section for configuration of Dummy Data Source.<br />
<img decoding="async" class="figureimage" title="SSIS DummyData Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/dummy-data-Source/ssis-dummy-data-source-adapter-drag.png" alt="SSIS DummyData Source - Drag and Drop" /></li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">ZS JSON Generator Transform</a> to produce JSON from a database or file records. If your source is already sending a valid JSON then you can skip this step (e.g. SQL query is<br />
returning JSON). You can also read raw JSON from a very large file (new-line separated JSON) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source with Output as Raw Data</a> option checked.<img decoding="async" class="figureimage" title="SSIS JSON Generator - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-transform-drag-2.png" alt="SSIS JSON Generator - Drag and Drop" /></li>
<li>Connect Source to JSON Generator. Double click JSON Generator Transform to start configuring it like below.</li>
<li>Select Output Mode as <strong>Single Dataset Array</strong> and enter Batch Size <strong>10000</strong> (This is Max limit allowed by Google BigQuery API <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll" target="_blank" rel="noopener">insertAll</a>)</li>
<li>First <strong>right click</strong> on Mappings node and select <strong>Add Static Element</strong>
<div id="attachment_8975" style="width: 862px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8975" class="size-full wp-image-8975" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png" alt="Generate JSON for Google BigQuery InsertAll API request - Batch 10000 rows in a single API call" width="852" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png 852w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-300x138.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-768x352.png 768w" sizes="(max-width: 852px) 100vw, 852px" /></a><p id="caption-attachment-8975" class="wp-caption-text">Generate JSON for Google BigQuery InsertAll API request &#8211; Batch 10000 rows in a single API call</p></div></li>
<li>Enter Name as <strong>kind</strong> and value as <strong><strong>bigquery#tableDataInsertAllRequest<br />
</strong></strong></p>
<div id="attachment_8976" style="width: 538px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8976" class="size-full wp-image-8976" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png" alt="JSON Generator - Add Static Element" width="528" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png 528w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value-300x212.png 300w" sizes="(max-width: 528px) 100vw, 528px" /></a><p id="caption-attachment-8976" class="wp-caption-text">JSON Generator &#8211; Add Static Element</p></div></li>
<li>Now right click on Mappings node and select <strong>Add Document Array</strong> option
<div id="attachment_8978" style="width: 464px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8978" class="wp-image-8978 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png" alt="JSON Generator - Add Document Array" width="454" height="349" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png 454w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option-300x231.png 300w" sizes="(max-width: 454px) 100vw, 454px" /></a><p id="caption-attachment-8978" class="wp-caption-text">JSON Generator &#8211; Add Document Array</p></div></li>
<li>Enter <strong>rows</strong> as array title and click OK
<div id="attachment_8979" style="width: 470px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8979" class="size-full wp-image-8979" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png" alt="JSON Generator - Name array" width="460" height="313" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png 460w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-300x204.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-8979" class="wp-caption-text">JSON Generator &#8211; Name array</p></div></li>
<li>Select newly added array node and right click &gt; Add <strong>unbound nested element</strong>  enter Output alias as <strong>json </strong>and click OK.
<div id="attachment_8980" style="width: 475px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8980" class="size-full wp-image-8980" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png" alt="JSON Generator - Add unbound nested element" width="465" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png 465w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element-296x300.png 296w" sizes="(max-width: 465px) 100vw, 465px" /></a><p id="caption-attachment-8980" class="wp-caption-text">JSON Generator &#8211; Add unbound nested element</p></div></li>
<li>Select <strong>json</strong> node and right click &gt; Select <strong>Add Elements below</strong> this node and select multiple columns you like to send to BigQuery. Click OK to save.
<div id="attachment_8981" style="width: 467px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8981" class="size-full wp-image-8981" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png" alt="JSON Generator - Add Multiple Elements" width="457" height="529" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png 457w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements-259x300.png 259w" sizes="(max-width: 457px) 100vw, 457px" /></a><p id="caption-attachment-8981" class="wp-caption-text">JSON Generator &#8211; Add Multiple Elements</p></div></li>
<li>Now let&#8217;s preview our JSON (Copy preview JSON to try in the next step &#8211; Web API destination)<div class="su-note"  style="border-color:#e5da9d;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:#fff4b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Table name and column names are case-sensitive so make sure your JSON attribute matches exact same way. </div></div>Here is the finished JSON Structure for next Step
<div id="attachment_8982" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8982" class="size-full wp-image-8982" src="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png" alt="Sample JSON Request body for Google BigQuery insertAll API request" width="847" height="671" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png 847w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-768x608.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-8982" class="wp-caption-text">Sample JSON Request body for Google BigQuery insertAll API request</p></div></li>
<li>Click OK to save UI.</li>
</ol>
<h3>Configure SSIS Web API destination &#8211; Insert data into BigQuery Table</h3>
<p>Once you have Input JSON prepared,  now let&#8217;s configure destination for BigQuery.</p>
<ol style="margin-left: 0;">
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API Destination</a>.</li>
<li>Connect your JSON Generator Transform to Web API destination.</li>
<li>Configure general properties:
<div id="attachment_2349" style="width: 869px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2349" class="size-full wp-image-2349" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png" alt="SSIS Web API Destination - Configure for BigQuery Data load" width="859" height="583" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png 859w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-768x521.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><p id="caption-attachment-2349" class="wp-caption-text">SSIS Web API Destination &#8211;<br />Configure for BigQuery Data load</p></div></li>
<li>Make sure to enter URL in this format:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre>
Make sure to replace 3 parts in above URL (MY_PROJECT_ID, MY_DATASET_ID, MY_TABLE_ID) with actual values from your Google Project and BigQuery dataset/table configuration.</li>
<li>Now you can enable Compression and Multiple Threads for higher throughput as below.<br />
<strong>NOTE:</strong> Compression Property was added in v3.1.4 so you may not see it if you have older version.</p>
<div id="attachment_8983" style="width: 1042px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8983" class="size-full wp-image-8983" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png" alt="Google BigQuery Data Loading Performance Optimization Options - Enable Multiple Threads and Compression Options" width="1032" height="347" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png 1032w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-300x101.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-768x258.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-1024x344.png 1024w" sizes="(max-width: 1032px) 100vw, 1032px" /></a><p id="caption-attachment-8983" class="wp-caption-text">Google BigQuery Data Loading Performance Optimization Options &#8211; Enable Multiple Threads and Compression Options</p></div></li>
<li>If you want to try test insert request from UI without running full package then go back to first tab and edit Body (Use Sample JSON generated by previous JSON Transform &#8211; You can grab from JSON Preview Panel on Generator Transform).Click Test Request / Response and confirm Success as below. You can go back to your BigQuery Portal and check one row is inserted after our test click. If everything looking good then run full package to insert all records.Sample JSON for Body:<br />
<pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre>
<div id="attachment_4919" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4919" class="size-full wp-image-4919" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png" alt="Test Google BigQuery Table Insert - SSIS Web API Destination UI" width="900" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-300x243.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-768x623.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-4919" class="wp-caption-text">Test Google BigQuery Table Insert &#8211; SSIS Web API Destination UI</p></div></li>
<li>Hit OK to save UI.</li>
<li>Run the package and verify data in Google BigQuery Console:
<div id="attachment_2351" style="width: 1206px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2351" class="size-full wp-image-2351" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png" alt="Loading data into Google BigQuery using SSIS" width="1196" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png 1196w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-300x157.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-768x401.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-1024x535.png 1024w" sizes="(max-width: 1196px) 100vw, 1196px" /></a><p id="caption-attachment-2351" class="wp-caption-text">Loading data into Google BigQuery using SSIS</p></div></li>
</ol>
<h2></h2>
<h2>Error Handling for BigQuery Data Load (Bulk Insert API Calls)</h2>
<p>There will be a time when some records you insert may not go well in Google BigQuery. In such case you can read output from Web API destination and parse further with JSON Parser Transform. Check for certain values in the output. You must use JSON Parser after Web API destination (Connect <strong>Blue Arrow</strong> from Web API destination &#8211; Since its Soft Error it won&#8217;t redirect in Red Arrow ).</p>
<p>For example here is the sample JSON in POST Body for testing which produces error due to bad column name. When bad row found in batch all records will be rejected. Notice that error returns index of record in batch so you can identify which row went bad. It also returns column name in location attribute.</p>
<p><strong>NOTE: Bad column name in 2nd record</strong></p>
<p><strong>Test Body (Bad):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RecordID": 1,"CustomerID": "X1"} }, 
     {"json": {"Bad_Column": 2,"CustomerID": "X2"} }
     {"json": {"RecordID": 3,"CustomerID": "X3"} }, 
   ]
}</pre><p>
&nbsp;</p>
<p><strong>Response (For Bad Input):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllResponse",
  "insertErrors": [
    {
      "index": 1,
      "errors": [
        {
          "reason": "invalid",
          "location": "bad_column",
          "debugInfo": "",
          "message": "no such field."
        }
      ]
    },
    {
      "index": 0,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    },
    {
      "index": 2,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<p>To configure error detection perform following steps.</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">ZS JSON Parser Transform</a> after Web API destination</li>
<li>Click on Web API destination. Connect Blue arrow  to JSON Parser Transform</li>
<li>Configure JSON Parser Transform like below</li>
<li>Connect JSON Parser TRansform to some Destination to save error information (e.g. SQL Table or Trans destination)</li>
</ol>
<div id="attachment_4920" style="width: 1111px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4920" class="size-full wp-image-4920" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png" alt="Handling BigQuery Insert Errors in SSIS " width="1101" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png 1101w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-768x515.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-1024x687.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-272x182.png 272w" sizes="(max-width: 1101px) 100vw, 1101px" /></a><p id="caption-attachment-4920" class="wp-caption-text">Handling BigQuery Insert Errors in SSIS</p></div>
<h2>Other Common Errors in BigQuery API calls</h2>
<p>In this section we will talk about many common API errors in BigQuery.</p>
<h3>Error: The project XXXXXXX has not enabled BigQuery</h3>
<p>Sometimes you might get below error. To fix this error make sure you go to your Project and <a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></p><pre class="crayon-plain-tag">Status Code: BadRequest

Response Body: {
  "error": {
    "code": 400,
    "message": "The project bigquerytest-281915 has not enabled BigQuery.",
    "errors": [
      {
        "message": "The project bigquerytest-281915 has not enabled BigQuery.",
        "domain": "global",
        "reason": "invalid"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}</pre><p>
<h3>Error: 404 &#8211; Not Found: Table / Job xxxxxx</h3>
<ul>
<li>Make sure you are setting GET request and not POST.</li>
<li>Also make sure your jobId is valid because it expires after 24 hours.</li>
<li>Make sure project-id supplied in URL is valid ID  (DO NOT Specify Alias, use internal ID for project)</li>
<li>
<div>Make sure you supplied location parameter if your outside EU / US region. Reading data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults" target="_blank" rel="noopener">this API call</a> might fail if you failed to supply <strong>location</strong> in URL</div>
</li>
</ul>
</p><pre class="crayon-plain-tag">{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found: Table xxxxxx"
   }
  ],
  "code": 404,
  "message": "Not Found: Table xxxxxxx
 }
}</pre><p>
&nbsp;</p>
<h3>Error: 403 &#8211; Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier</h3>
<p>If you trying call certain APIs on sandbox mode or free tier then you might get below error. To overcome this error <a href="https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project" target="_blank" rel="noopener">enable billing on google bigquery</a>. As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call.</p><pre class="crayon-plain-tag">Response Url: https://www.googleapis.com/bigquery/v2/projects/bigquerytest-281915/datasets/TestDataset/tables/Table1/insertAll

Status Code: Forbidden

Response Body: {
  "error": {
    "code": 403,
    "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
    "errors": [
      {
        "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
        "domain": "global",
        "reason": "accessDenied"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<h2>Debugging Web API Requests</h2>
<p>If you need to debug actual requests made to Google server then you can use a tool like <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a>. It&#8217;s a very handy tool to troubleshoot JSON format issues. It will allow to see how a request is made to a server.</p>
<div id="attachment_2352" style="width: 1076px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2352" class="size-full wp-image-2352" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png" alt="Using Fiddler to debug Google BigQuery API requests in SSIS" width="1066" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png 1066w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-768x518.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-1024x691.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-272x182.png 272w" sizes="(max-width: 1066px) 100vw, 1066px" /></a><p id="caption-attachment-2352" class="wp-caption-text">Using Fiddler to debug Google BigQuery API requests in SSIS</p></div>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download Sample Package</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/Google_BigQuery_API_Read_Write_Create_Delete_Sample_SSIS2019_2017_2012.zip">Click Here to Download SSIS Sample Package &#8211; Google BigQuery API Read Write Create Delete (SSIS 2019, 2017, 2012)</a></p>
<p>&nbsp;</p>
<h2>Conclusion. What&#8217;s next?</h2>
<p>In this article we have learned how to load data from Google BigQuery into SQL Server using SSIS (drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from Google BigQuery REST API using OAuth. JSON Source Connector makes it super simple to parse complex/large JSON files or any Web API response into rows and columns so you can load data into a database, e.g. SQL Server database. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios that were not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>Google BigQuery Integration with SQL Server | How to extract data from google bigquery in SSIS? | How to read data from Google BigQuery API? | Loading BigQuery Data into SQL Server. | BigQuery to SQL Server | SSIS Google Big Query Integration | SSIS Google BigQuery Import  JSON File | SSIS Google BigQuery Export data</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Loading data from SQL Server to Elasticsearch with SSIS</title>
		<link>https://zappysys.com/blog/load-data-from-sql-server-to-elasticsearch-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 16 Jun 2017 17:08:12 +0000</pubDate>
				<category><![CDATA[HTTP Connection]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS Connection Manager]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[elasticsearch]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis web api destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1365</guid>

					<description><![CDATA[<p>Introduction Elasticsearch is a powerful engine that allows you to store, aggregate, and, most importantly, search data in a very analytical way. In this tutorial, you will learn how to bulk load data from SQL Server to Elasticsearch with SSIS (part of SQL Server) and ZappySys PowerPack. The scope of this article will be to show how to import [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/load-data-from-sql-server-to-elasticsearch-using-ssis/">Loading data from SQL Server to Elasticsearch with SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<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;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/elasticsearch-connector/">API Connector for ElasticSearch</a> which makes it much simpler to <strong>Read/Write ElasticSearch Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid a learning curve with API then use a newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> preconfigured ready-to-use API connectors that you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, and Informatica).</p>
</div></div>
<img loading="lazy" decoding="async" class="alignleft wp-image-1406 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180.png" alt="" width="180" height="180" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180.png 180w, https://zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180-150x150.png 150w" sizes="(max-width: 180px) 100vw, 180px" /></p>
<p><a href="https://www.elastic.co/" target="_blank" rel="noopener">Elasticsearch</a> is a powerful engine that allows you to store, aggregate, and, most importantly, search data in a very analytical way. In this tutorial, you will learn how to bulk load data from <em>SQL Server to Elasticsearch </em>with <a href="https://docs.microsoft.com/en-us/sql/integration-services/sql-server-integration-services" target="_blank" rel="noopener"><acronym title="SQL Server Integration Services">SSIS</acronym></a> (part of SQL Server) and <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys PowerPack</a>.</p>
<p>The scope of this article will be to show how to import records from SQL Server into Elasticsearch index as JSON documents using <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html" target="_blank" rel="noopener">Elasticsearch Bulk API</a>. In a nutshell, we will retrieve IDs and names of the products from a SQL table, transform each row into a JSON and lastly, index each JSON in Elasticsearch under record&#8217;s corresponding ID. This tutorial is going to be your stepping stone to use any Elasticsearch API as a destination.</p>
<p>We will be using these SSIS components of PowerPack to make things work:</p>
<div class="su-table su-table-alternate">
<table width="276">
<tbody>
<tr style="line-height: 0px">
<td width="50px"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1382" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-generator-transform.png" alt="" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></td>
</tr>
<tr style="line-height: 0px">
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1383" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-web-api-destination.png" alt="" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></td>
</tr>
</tbody>
</table>
</div>
<p>Let&#8217;s begin?</p>
<h2>Prerequisites</h2>
<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><em>Northwind</em> database deployed on your machine (we will use it to load data from; <a href="//zappysys.com/blog/wp-content/uploads/2017/06/Northwind.zip" target="_blank" rel="noopener">download it</a>).</li>
<li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html" target="_blank" rel="noopener"><i>Elasticsearch </i>instance up and running</a>.</li>
<li><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>.</li>
</ol>
<p>&nbsp;</p>
<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;"><strong>NOTE:</strong> If your ElasticSearch instance is hosted as <a href="https://aws.amazon.com/elasticsearch-service/" target="_blank" rel="noopener">AWS Managed ElasticSearch Instance</a> then select  <pre class="crayon-plain-tag">&lt;New ZS-OAUTH Connection&gt;</pre>. rather than ZS-HTTP (Explained later in this article). When OAuth UI launches select AWS v4 Provider. For more information on <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">calling REST API on AWS check this article</a>. </div></div>
<h2>Step-by-Step – Bulk loading data from SQL Server to Elasticsearch with SSIS</h2>
<h3>Load data from SQL Server database first</h3>
<p>In this section, you will perform several basic steps to start the package: load data from SQL Server and prepare it for further steps.</p>
<ol>
<li>Create a new SSIS package and drag a <em>Data Flow Task</em> into the <em>Control Flow</em> from the SSIS Toolbox.
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Open <em>Data Flow Task</em> and then add <em>OLE DB Source.</em></li>
<li>Configure OLE DB Source to take data from <em>Products </em>table<em>, Northwind</em> database.</li>
<li>Choose <em>ProductID</em> and <em>ProductName</em> as columns you will use.
<div id="attachment_2394" style="width: 251px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2394" class="wp-image-2394 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png" alt="Load data to Elasticsearch using SSIS and ZappySys Web API Destination component." width="241" height="306" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png 241w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3-236x300.png 236w" sizes="(max-width: 241px) 100vw, 241px" /></a><p id="caption-attachment-2394" class="wp-caption-text">Load data to Elasticsearch using SSIS and ZappySys Web API Destination component.</p></div></li>
</ol>
<h3>Transform data into JSON documents</h3>
<p>To add data into Elasticsearch firstly we need to prepare it with <em>JSON Generator Transform. </em>It will help us convert table rows into JSON documents.</p>
<h4>JSON String to Create Index data for the Bulk API call</h4>
<ol>
<li>Close the window and then drag <em>Derived Column </em>component from the SSIS Toolbox.</li>
<li>Furthermore, Add two new columns and name them <pre class="crayon-plain-tag">RowHeader</pre> and <pre class="crayon-plain-tag">RowFooter</pre>:
<div id="attachment_2406" style="width: 691px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2406" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a><p id="caption-attachment-2406" class="wp-caption-text">Derived Column configuration to add prefix and header and footer to a JSON</p></div>
<p>In the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"index\": { \"_index\": \"shop\", \"_type\": \"products\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n"</pre>
</li>
<li><strong>RowFooter</strong>:  <pre class="crayon-plain-tag">"\n"</pre></li>
</ul>
</li>
<li>Now drag <em>JSON Generator Transform</em> from the SSIS Toolbox and open it.</li>
<li>Right mouse click on item <em>Mappings </em>and select <pre class="crayon-plain-tag">Add Element(s) (Below this node)</pre>:
<div id="attachment_1415" style="width: 330px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1415" class="wp-image-1415 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png" alt="Convert SQL table rows into JSON using JSON Generator Transform" width="320" height="116" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png 320w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-300x109.png 300w" sizes="(max-width: 320px) 100vw, 320px" /></a><p id="caption-attachment-1415" class="wp-caption-text">Convert SQL table rows into JSON using <em>JSON Generator Transform</em></p></div></li>
<li>Once a dialog appears, select <pre class="crayon-plain-tag">ProductName</pre> as <em>Source Column</em> and <pre class="crayon-plain-tag">name</pre> as <em>Output Alias:<br />
</em></p>
<div id="attachment_1526" style="width: 386px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1526" class="size-full wp-image-1526" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg" alt="Map table column to JSON property using JSON Generator Transform" width="376" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg 376w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3-258x300.jpg 258w" sizes="(max-width: 376px) 100vw, 376px" /></a><p id="caption-attachment-1526" class="wp-caption-text">Map table column to JSON property using <em>JSON Generator Transform</em></p></div></li>
<li>You should get a similar view:
<div id="attachment_2396" style="width: 728px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2396" class="wp-image-2396 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png" alt="JSON Generator Transform configuration to create JSON from a SQL table" width="718" height="320" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png 718w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2-300x134.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></a><p id="caption-attachment-2396" class="wp-caption-text"><em>JSON Generator Transform</em> configuration to create JSON from a SQL table</p></div></li>
<li>Then go to <em>Header / Footer</em> tab and:
<ul>
<li>Select <pre class="crayon-plain-tag">Direct String</pre> option.</li>
<li>Input <pre class="crayon-plain-tag">&lt;%RowHeader%&gt;</pre> in <em>Header String</em> option.</li>
<li>Input <pre class="crayon-plain-tag">&lt;%RowFooter%&gt;</pre> in <em>Footer String</em> option.</li>
</ul>
<div id="attachment_2403" style="width: 728px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2403" class="wp-image-2403 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585.png" alt="JSON Generator Transform configuration to convert rows into JSON suitable for Elasticsearch Bulk operation" width="718" height="400" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585.png 718w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585-300x167.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></a><p id="caption-attachment-2403" class="wp-caption-text"><em>JSON Generator Transform</em> configuration to convert rows into JSON suitable for Elasticsearch Bulk operation</p></div></li>
<li>Close the window.</li>
</ol>
<h4>JSON String to Update Index data for the Bulk API call</h4>
<p>From the above section &#8220;<strong>JSON String to Create Index data for the Bulk API call&#8221; </strong>follows all the steps From <strong>Step-1 to Step-8.</strong></p>
<p>Just for (2nd step) <strong>Step-2</strong> use below expression for  <pre class="crayon-plain-tag">RowHeader</pre> and <pre class="crayon-plain-tag">RowFooter</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a></p>
<p>Derived Column configuration to add prefix and header and footer to a JSONIn the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"update\": { \"_index\": \"shop\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n{ \"doc\" : "</pre>
</li>
<li><strong>RowFooter</strong>:  <pre class="crayon-plain-tag">"}\n"</pre></li>
</ul>
<div class="su-note"  style="border-color:#e5dd9d;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:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: To learn how to make more complicated transforms visit these links:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/</a> (check the video)</li>
<li><a href="https://zappysys.com/blog/tag/ssis-json-generator-transform/" target="_blank" rel="noopener">https://zappysys.com/blog/tag/ssis-json-generator-transform/</a></li>
</ul>
</div></div>
<h4>JSON String to Delete Index data for the Bulk API call</h4>
<p>From the above section &#8220;<strong>JSON String to Create Index data for the Bulk API call&#8221; </strong>follows steps <strong>Step-1 and Step-2.</strong></p>
<div class="su-note"  style="border-color:#e5dd9d;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:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: No need to use JSON Generator Transform (From Step-3). </div></div>
<p>Just for (2nd step) <strong>Step-2</strong> use below expression for  <pre class="crayon-plain-tag">RowHeader</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a></p>
<p>Derived Column configuration to add prefix and header and footer to a JSON</p>
<p>In the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"delete\": { \"_index\": \"shop\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n"</pre>
</li>
</ul>
<h3>Finally, Elasticsearch &amp; SQL Server integration</h3>
<ol>
<li>Now drag <em>Web API Destination</em> SSIS component into the Data Flow and open it for editing.</li>
<li>In <em>Select Connection</em> section press <pre class="crayon-plain-tag">&lt;New ZS-HTTP Connection&gt;</pre>.<br />
<strong>NOTE:</strong> If your ElasticSearch instance is hosted as AWS Managed Service then select  <pre class="crayon-plain-tag">&lt;New ZS-OAUTH Connection&gt;</pre>. rather than ZS-HTTP. When OAuth UI launches select AWS v4 Provider. For more information on <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">calling REST API on AWS check this article</a>.</li>
<li>Once <em>HTTP Connection Manager</em> window opens configure connection to your Elasticsearch instance:
<ul>
<li>Set <em>Web Url</em>, which points to your Elasticsearch instance.</li>
<li>Set <em>Credentials Type</em> to <pre class="crayon-plain-tag">Basic - UserID/Password</pre> (or other appropriate authentication method).</li>
<li>Finally, set <em>User Name</em> and <em>Password:<br />
</em></p>
<div id="attachment_1419" style="width: 330px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1419" class="wp-image-1419 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png" alt="Configure SSIS HTTP Connection to connect to Elasticsearch" width="320" height="207" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png 320w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection-300x194.png 300w" sizes="(max-width: 320px) 100vw, 320px" /></a><p id="caption-attachment-1419" class="wp-caption-text">Configure SSIS <em>HTTP Connection</em> to connect to Elasticsearch</p></div></li>
</ul>
</li>
<li>Close configuration window. Now it&#8217;s time to configure <em>Web API Destination</em>.</li>
<li>All that is separating you from getting those rows into Elasticsearch is:
<ul>
<li>Setting <em>Input Column</em> <em>for Body</em> to <pre class="crayon-plain-tag">ZS_JSON_OUT</pre> for <strong>Create and Update</strong> Index Data and for <strong>Delete</strong> Index Data <em>Input Column for Body</em> to <pre class="crayon-plain-tag">RowHeader [Derived Column]</pre>.</li>
<li>Setting <em>URL</em> to <pre class="crayon-plain-tag">http://localhost:9200/_bulk</pre>.</li>
<li>Setting <em>HTTP Request</em> Method to <pre class="crayon-plain-tag">POST</pre>.</li>
</ul>
<div id="attachment_2397" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2397" class="wp-image-2397 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-2.png" alt="Index SQL Server Database data in Elasticsearch using SSIS component &quot;Web API Destination&quot;" width="701" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-2.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-2-300x267.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-2397" class="wp-caption-text">Index SQL Server Database data in Elasticsearch using SSIS component <em>Web API Destination</em></p></div></li>
<li>Then open <em>Batch Settings (For Body)</em> tab:
<ul>
<li>Enable batch submission.</li>
<li>Set <em>Body Batch Size, </em>e.g. 1000<em>. </em>Make sure this number is even, otherwise you may get into problems (Elasticsearch Bulk request has special JSON request body format, as you perhaps noticed).</li>
</ul>
<div id="attachment_2415" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2415" class="wp-image-2415 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png" alt="Web API Destination batch settings configuration" width="701" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3-300x267.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-2415" class="wp-caption-text"><em>Web API Destination</em> batch settings configuration</p></div></li>
<li>Close the window and run the package! You should see green lights, telling you everything is OK:
<div id="attachment_2398" style="width: 302px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2398" class="wp-image-2398 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png" alt="Successful data load from SQL Server to Elasticsearch" width="292" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png 292w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2-224x300.png 224w" sizes="(max-width: 292px) 100vw, 292px" /></a><p id="caption-attachment-2398" class="wp-caption-text">Successful data load from SQL Server to Elasticsearch</p></div></li>
<li>We can also query Elasticsearch by using one of its <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html" target="_blank" rel="noopener">Search APIs</a> &#8211; <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html" target="_blank" rel="noopener">URI Search</a> to see if we successfully indexed data:
<div id="attachment_1470" style="width: 363px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1470" class="wp-image-1470" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png" alt="SQL Server data index in Elasticsearch" width="353" height="450" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png 429w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results-235x300.png 235w" sizes="(max-width: 353px) 100vw, 353px" /></a><p id="caption-attachment-1470" class="wp-caption-text">SQL Server data index in Elasticsearch</p></div></li>
<li>Rows number match in SSIS and in search results, thus everything is good. You are done.</li>
</ol>
<h3>What if I want more? After upserting data use <em>Web API Destination</em> further</h3>
<p>Let&#8217;s say you have a requirement to do something with rows that were freshly indexed in Elasticsearch. Then you will need somehow to distinguish between created and updated records in Elasticsearch. And that won&#8217;t be difficult because <em>Web API Destination</em> acts not only as <span style="text-decoration: underline;">Destination</span> but as <span style="text-decoration: underline;">Transformation</span> as well. So one thing you have to do is connect <em><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></em> downstream to <em>Web API Destination</em>. It will parse Elasticsearch HTTP JSON response – which is returned by <em>Web API Destination –</em> into columns, which you can later easily redirect using <em>Conditional Split:</em></p>
<ol>
<li>Add <em>JSON Parser Transform</em> and connect it to <em>Web API Destination</em>:
<div id="attachment_1476" style="width: 415px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1476" class="size-full wp-image-1476" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing.png" alt="Add JSON Parser Transform to get Elasticsearch HTTP JSON response when integrating SQL Server &amp; Elasticsearch" width="405" height="394" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing.png 405w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing-300x292.png 300w" sizes="(max-width: 405px) 100vw, 405px" /><p id="caption-attachment-1476" class="wp-caption-text">Use <em>JSON Parser Transform</em> to get Elasticsearch HTTP JSON response when integrating SQL Server &amp; Elasticsearch</p></div></li>
<li>Make sure you have selected <pre class="crayon-plain-tag">ResponseText</pre> as <em>Select Input JSON Column.</em></li>
<li>Then go to <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html" target="_blank" rel="noopener">Bulk API</a> and copy/paste &#8220;the result of this bulk operation&#8221; JSON response:
<div id="attachment_2399" style="width: 714px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2399" class="wp-image-2399 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png" alt="Using JSON Parser Transform to parse JSON response from REST HTTP request" width="704" height="622" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png 704w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration-300x265.png 300w" sizes="(max-width: 704px) 100vw, 704px" /></a><p id="caption-attachment-2399" class="wp-caption-text">Using <em>JSON Parser Transform</em> to parse JSON response from REST HTTP request</p></div></li>
<li>Set <pre class="crayon-plain-tag">$.items[*]</pre> as the filter.</li>
<li><strong>Optional step</strong>. You won&#8217;t find a response sample for every Elasticsearch API call. In that case, you may want to use <a href="http://www.getpostman.com" target="_blank" rel="noopener">Postman</a> to make an HTTP request to Elasticsearch and get a sample response:
<div id="attachment_1513" style="width: 589px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1513" class="wp-image-1513 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png" alt="Use Postman to make a request to Elasticsearch and get a sample response to be used in JSON Parser Transform" width="579" height="587" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png 579w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot-296x300.png 296w" sizes="(max-width: 579px) 100vw, 579px" /></a><p id="caption-attachment-1513" class="wp-caption-text">Use <em>Postman</em> to make a request to Elasticsearch and get a sample response to be used in <em>JSON Parser Transform</em></p></div>
<div class="su-note"  style="border-color:#e5dd9d;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:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: Don&#8217;t forget to set the username and password in <em>Authorization</em> section!</div></div></li>
<li>Then use a <em>Conditional Split </em>and <a href="//zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=trash-destination.htm" target="_blank" rel="noopener">Trash Destination</a> to redirect the rows:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2410" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png" alt="" width="893" height="394" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png 893w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split-300x132.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split-768x339.png 768w" sizes="(max-width: 893px) 100vw, 893px" /></a><br />
Input these clauses:</p>
<ul>
<li><strong>Inserted</strong>:<br />
<pre class="crayon-plain-tag">REPLACENULL([index.result],"") == "created" || REPLACENULL([create.result],"") == "created"</pre>
</li>
<li><strong>Updated</strong>:<br />
<pre class="crayon-plain-tag">REPLACENULL([index.result],"") == "updated" || REPLACENULL([create.result],"") == "updated"</pre>
</li>
</ul>
</li>
<li>As a result, new index records will be redirected to one destination, while updated records &#8211; to the other:<br />
<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png"><img loading="lazy" decoding="async" width="423" height="388" class="wp-image-1478 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png" alt="&quot;Result" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png 423w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results-300x275.png 300w" sizes="(max-width: 423px) 100vw, 423px" /></a></li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;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:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: <em>Trash Destination</em> is a handy component of <em>ZappySys PowerPack</em> which can be used as dummy destination when we don&#8217;t care about the destination (and we don&#8217;t care in this tutorial) 🙂</div></div>
<p>Overall you can use <em>Web API Destination</em> HTTP JSON response for other useful things as well, e.g. determine on how many <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html#getting-started-shards-and-replicas" target="_blank" rel="noopener">replica shards</a> record was indexed. JSON response will depend on which Elasticsearch API and which method you use.</p>
<h3>Delete Index by making an API call.</h3>
<p>If you want to delete the index by making <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html" target="_blank" rel="noopener">Delete API</a> call you can. Let&#8217;s make that call using the Rest API Task. Configure it like below screen and click on the Test Request button.</p>
<div id="attachment_8605" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8605" class="wp-image-8605 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-768x523.png" alt="Rest API Delete Method" width="720" height="490" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-768x523.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method.png 901w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-8605" class="wp-caption-text">Rest API Delete Method</p></div>
<h3>Things went bad: Error handling &amp; debugging</h3>
<p>Incidentally, you may incorrectly construct JSON for <em>Web API Destination</em> body<i>. </i>Elasticsearch nodes may go offline or go out of memory. In any case you may want to know when that happens and take actions accordingly. For that purpose you have to redirect failed requests from <em>Web API Destination</em> to some other destination:</p>
<ol>
<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <pre class="crayon-plain-tag">(DT_WSTR,4000)ZS_JSON_OUT</pre> and name it <pre class="crayon-plain-tag">JsonAsString</pre>. This will let you see what JSON you are actually passing.</li>
<li>After that, add database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em>Web API Destination </em>into it<em>. </em>Don&#8217;t forget to set <pre class="crayon-plain-tag">Redirect row</pre> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><br />
</em><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png"><img loading="lazy" decoding="async" width="739" height="267" class="wp-image-1487 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="&quot;Redirect" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a></li>
<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div id="attachment_1494" style="width: 762px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1494" class="wp-image-1494 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a><p id="caption-attachment-1494" class="wp-caption-text">Use<em> Data Viewer</em> to view HTTP requests that failed to be fulfilled in Elasticsearch</p></div></li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;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:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div></div>
<h2>Call ElasticSearch API hosted on AWS</h2>
<p>If your ElasticSearch instance is hosted as <a href="https://aws.amazon.com/elasticsearch-service/" target="_blank" rel="noopener">AWS Managed ElasticSearch Instance</a> then select  <pre class="crayon-plain-tag">&lt;New ZS-OAUTH Connection&gt;</pre>. rather than ZS-HTTP (Explained later in this article). When OAuth UI launches select AWS v4 Provider. For more information on <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">calling REST API on AWS check this article</a>.</p>
<div id="attachment_6277" style="width: 836px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6277" class="size-full wp-image-6277" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png" alt="Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)" width="826" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-300x265.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-768x679.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6277" class="wp-caption-text">Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)</p></div>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download a sample package</h2>
<p>Be sure to download a <a href="https://zappysys.com/blog/wp-content/uploads/2017/06/Bulk-load-data-from-SQL-Server-to-Elasticsearch-using-SSIS.zip">sample SQL Server 2008 SSIS package</a>, in case you want to try it right away (you can upgrade it to a higher version).<br />
<div class="su-note"  style="border-color:#e5dd9d;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:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: Once you open the package, you won’t be able to run it immediately, but don’t panic. Just configure OLE DB Source to point to your Northwind database and set URLs to point to your Elasticsearch instance.</div></div>
<h2>Conclusion. What&#8217;s next?</h2>
<p>In conclusion, in this article we have learned how to bulk load data from SQL Server and upsert it in Elasticsearch index. We used <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a> to help us convert database table rows into JSON documents. In addition, <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> was very helpful in automatically creating and making HTTP requests to Elasticsearch instance and indexing our data as a result. This tutorial was quite simple and straightforward, yet it is a good starter to use other Elasticsearch APIs and their features. From now on <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" target="_blank" rel="noopener">Elasticsearch reference</a> is your best friend in learning what APIs exist, what are their methods and how HTTP requests should look like.</p>
<p><strong>Keywords</strong></p>
<p>How to import data from SQL Server to Elasticsearch | How to load data into Elasticsearch | Using Elasticsearch to index SQL Server | Elasticsearch and SQL Server integration | How to use Elasticsearch together with SQL Server | Upsert SQL Server data into Elasticsearch</p>
<p>The post <a href="https://zappysys.com/blog/load-data-from-sql-server-to-elasticsearch-using-ssis/">Loading data from SQL Server to Elasticsearch with SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to create MongoDB documents (JSON, BSON) for loading in SSIS</title>
		<link>https://zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 30 Aug 2016 15:07:22 +0000</pubDate>
				<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[BSON]]></category>
		<category><![CDATA[ISODate]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS MongoDB Destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=742</guid>

					<description><![CDATA[<p>Introduction In our previous article, we discussed how to load data into MongoDB (Insert, Update, or Upsert Mode) with various options. In this post, we will focus on creating a MongoDB Document for the load process. We will see how to produce BSON (MongoDB-specific JSON that may include functions such as ObjectID and ISODate). This article assumes you have [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/">How to create MongoDB documents (JSON, BSON) for loading in 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/08/mongodb-logo.png"><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /></a><span style="box-sizing: border-box; margin: 0px; padding: 0px;">In our previous article, we discussed how to <a target="_blank" rel="noopener">load data into MongoDB (Insert, Update, or Upsert Mode)</a> with various options. </span>In this post, we will focus on creating a MongoDB Document for the load process. We will see how to produce BSON (MongoDB-specific JSON<span style="box-sizing: border-box; margin: 0px; padding: 0px;"> that may include functions such as <em>ObjectID and</em></span> <em>ISODate</em>).</p>
<p>This article assumes you have installed <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> and watched the introduction videos of <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/" target="_blank" rel="noopener">MongoDB Destination Connector</a></p>
<h2>Create MongoDB document Example (Produce JSON, BSON for Load)</h2>
<p>Here is the screenshot, which shows how to fetch SQL Server data &gt; create a MongoDB document in JSON / BSON format, and load it into a MongoDB collection</p>
<p>The high-level steps we performed are</p>
<ol>
<li>Used OLEDB Source to fetch data from SQL Server. Used a query like below<br />
<pre class="crayon-plain-tag">select CustomerID, 'ISODate("' + convert(varchar(30),getdate(),126) + '")' as DOB from Customers</pre>
In the above query, you will notice that we are building some BSON fragments, which will be treated as raw values in the JSON generator. Also, we are using the convert function from SQL Server to produce an ISO date format (Style=126 will produce an ISO date)</li>
<li>Used the <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> to produce a JSON document for each customer. Define a custom layout using the drag-and-drop interface. You can control how many documents you want to output using settings on Transform (Single document for all input rows or one document per row in the Main dataset)</li>
<li>Load JSON documents coming from upstream into MongoDB using the <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/" target="_blank" rel="noopener">SSIS MongoDB Destination Connector</a>. We changed Action=Upsert and set ColumnsForLookup to CustomerID (Consider this as Primary Key or your Join Column to find existing document)</li>
<li>On Target, we mapped __DOCUMENT__ rather than individual columns, so that we can load the full document.
<div id="attachment_11582" style="width: 775px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/08/Sample-SSIS-Package-Create-MongoDB-Document-in-BSON-format-JSON-with-functions.-Update-or-Insert-Mode.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11582" class="size-full wp-image-11582" src="https://zappysys.com/blog/wp-content/uploads/2016/08/Sample-SSIS-Package-Create-MongoDB-Document-in-BSON-format-JSON-with-functions.-Update-or-Insert-Mode.png" alt="" width="765" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2016/08/Sample-SSIS-Package-Create-MongoDB-Document-in-BSON-format-JSON-with-functions.-Update-or-Insert-Mode.png 765w, https://zappysys.com/blog/wp-content/uploads/2016/08/Sample-SSIS-Package-Create-MongoDB-Document-in-BSON-format-JSON-with-functions.-Update-or-Insert-Mode-300x245.png 300w" sizes="(max-width: 765px) 100vw, 765px" /></a><p id="caption-attachment-11582" class="wp-caption-text">Sample SSIS Package &#8211; Create MongoDB Document in BSON format (JSON with functions). Update or Insert Mode</p></div></li>
</ol>
<h2>Configure JSON Generator Transform &#8211; Create JSON Document</h2>
<p>If you want to learn how to configure the <a target="_blank" rel="noopener">SSIS JSON Generator Transform,</a> then watch the video <a target="_blank" rel="noopener">here.</a> Important thing to remember in the configuration is to check the <strong>Treat value of this column as Raw JSON</strong></p>
<div id="attachment_11581" style="width: 938px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/08/Create-MongoDB-Document-in-JSON-or-BSON-format-Load-into-Collection-Upsert-Update-or-Insert.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11581" class="size-full wp-image-11581" src="https://zappysys.com/blog/wp-content/uploads/2016/08/Create-MongoDB-Document-in-JSON-or-BSON-format-Load-into-Collection-Upsert-Update-or-Insert.png" alt="" width="928" height="652" srcset="https://zappysys.com/blog/wp-content/uploads/2016/08/Create-MongoDB-Document-in-JSON-or-BSON-format-Load-into-Collection-Upsert-Update-or-Insert.png 928w, https://zappysys.com/blog/wp-content/uploads/2016/08/Create-MongoDB-Document-in-JSON-or-BSON-format-Load-into-Collection-Upsert-Update-or-Insert-300x211.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/08/Create-MongoDB-Document-in-JSON-or-BSON-format-Load-into-Collection-Upsert-Update-or-Insert-768x540.png 768w" sizes="(max-width: 928px) 100vw, 928px" /></a><p id="caption-attachment-11581" class="wp-caption-text">Create MongoDB Document in JSON or BSON format &#8211; Load into Collection (Upsert &#8211; Update or Insert)</p></div>
<h2>Configure MongoDB Destination &#8211; For Upsert (Update or Insert Mode)</h2>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">By default, the <a target="_blank" rel="noopener">SSIS MongoDB Destination Connector</a> performs an insert, but if you want to perform an Upsert (i.e., insert if not found, else update), you have to change a few settings.</span></p>
<ol>
<li>Change Operation to UpdateOrInsert</li>
<li>Set ColumnsForLookup (e.g., in our case, it was just one CustomerID). If you have multiple columns for join, then use a comma-separated list (e.g., City, State, Zip)</li>
<li>If you want to affect various documents if more than one match is found for the join criteria, then use multi=true as shown in the screenshot below (see LoadOptions )
<div id="attachment_11580" style="width: 1003px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/08/Configure-SSIS-MongoDB-destination-for-Upsert-operation.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11580" class="size-full wp-image-11580" src="https://zappysys.com/blog/wp-content/uploads/2016/08/Configure-SSIS-MongoDB-destination-for-Upsert-operation.png" alt="" width="993" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2016/08/Configure-SSIS-MongoDB-destination-for-Upsert-operation.png 993w, https://zappysys.com/blog/wp-content/uploads/2016/08/Configure-SSIS-MongoDB-destination-for-Upsert-operation-300x160.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/08/Configure-SSIS-MongoDB-destination-for-Upsert-operation-768x408.png 768w" sizes="(max-width: 993px) 100vw, 993px" /></a><p id="caption-attachment-11580" class="wp-caption-text">Configure the SSIS MongoDB destination for the Upsert operation</p></div></li>
</ol>
<div class="mceTemp"></div>
<h2>Conclusion</h2>
<p>In this post, you have seen how easy it is to create MongoDB Documents in JSON / BSON format and load them into a MongoDB collection using <a target="_blank" rel="noopener">ZappySys SSIS PowerPack</a>. This innovative drag-and-drop approach can simplify the entire ETL process if you are in a time crunch and don&#8217;t know scripting languages.</p>
<p>The post <a href="https://zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/">How to create MongoDB documents (JSON, BSON) for loading in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Read / Write Amazon DynamoDB in SSIS</title>
		<link>https://zappysys.com/blog/how-to-query-amazon-dynamodb-read-write-update/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 01 Jul 2016 13:27:53 +0000</pubDate>
				<category><![CDATA[SSIS Amazon DynamoDB Destination]]></category>
		<category><![CDATA[SSIS Amazon DynamoDB ExecuteSQL Task]]></category>
		<category><![CDATA[SSIS Amazon DynamoDB Src]]></category>
		<category><![CDATA[SSIS Dummy Data Source]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[DynamoDB]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS Amazon DynamoDB Source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=662</guid>

					<description><![CDATA[<p>Introduction In this article we will look at how to Read / Write Amazon DynamoDB in SSIS. ZappySys developed many AWS related components but in this article we will look at 3 Tasks/Components for DynamoDB Integration Scenarios (Read, Write, Update, Bulk Insert, Create / Drop Table etc.). We will discuss how to use SSIS DynamoDB Source Connector [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-query-amazon-dynamodb-read-write-update/">How to Read / Write Amazon DynamoDB in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this article we will look at how to Read / Write Amazon DynamoDB in SSIS. ZappySys developed many AWS related components but in this article we will look at 3 Tasks/Components for DynamoDB Integration Scenarios (Read, Write, Update, Bulk Insert, Create / Drop Table etc.). We will discuss how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-dynamodb-source/" target="_blank" rel="noopener">SSIS DynamoDB Source Connector</a> , <a href="//zappysys.com/products/ssis-powerpack/ssis-dynamodb-destination/" target="_blank" rel="noopener">SSIS DynamoDB Destination Connector</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-dynamodb-executesql-task/" target="_blank" rel="noopener">SSIS DynamoDB ExecuteSQL Task</a> . DynamoDB Source connector supports familiar <strong>SQL Like query language</strong> so any DBA or SQL user can learn it in no time. ZappySys developed highly sophisticated engine to turn your SQL Query into native DynamoDB query. For more information check <a href="//zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=amazon-dynamodb-source.htm" target="_blank" rel="noopener">this help file</a></p>
<div style="width: 265px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-extract-data-sample.png" alt="SSIS Amazon DynamoDB Source Connector - Extract data from DynamoDB" width="255" height="208" /><p class="wp-caption-text">Extract data from Amazon DynamoDB in SSIS</p></div>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol style="margin-left: 1.5em;">
<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven&#8217;t already).</li>
<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol>
</div>
<h2>Video Tutorial &#8211; Read/Write/Update data in Amazon DynamoDB in SSIS</h2>
<p>Below video tutorial will show you from start to end how to use ZappySys Components to perform various AWS DynamoDB Integration Tasks such as Reading Bulk data, Writing bulk data, Executing ad-hock Command for DynamoDB (such as Create/Drop Table). Get Row Count etc.<br />
<a href="https://zappysys.com/blog/how-to-query-amazon-dynamodb-read-write-update/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2Fyt70gZRQ9bA%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Using Amazon DynamoDB Emulator for Local Testing</h2>
<p>If you don&#8217;t have AWS Cloud account and you still want to try DynamoDB related options in SSIS then you can use FREE Local Emulator for DynamoDB.</p>
<ol>
<li> <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html" target="_blank" rel="noopener">Download it from here</a>.</li>
<li>Extract to local folder (e.g. c:\tools\dynamodb_local</li>
<li>Create a batch file there call it RunDynamo.bat and you can put command like below.<br />
<pre class="crayon-plain-tag">&quot;java.exe&quot; -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb</pre>
Or (Java Home Path not set use below)<br />
<pre class="crayon-plain-tag">&quot;C:\Program Files\Java\jdk--YOUR-VERSION\bin\java.exe&quot; -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb</pre>
</li>
<li>Double click Batch file to launch DynamoDB Local instance</li>
</ol>
<h2>Connect to DynamoDB in SSIS</h2>
<p>Now lets look at step by step how to Connect to DynamoDB in SSIS. For Simple demo we will use  <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-dynamodb-executesql-task/">ZS Amazon DynamoDB ExecuteSQL Task</a> but in next section we will show you How to Read / Write DynamoDB Data using other SSIS Components.</p>
<h3>Create SSIS DynamoDB Connection / List Tables Example</h3>
<ol>
<li>Installed <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">SSIS PowerPack</a> if you have not done it.</li>
<li>Open SSIS Package</li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-dynamodb-executesql-task/">ZS Amazon DynamoDB ExecuteSQL Task</a>  from SSIS Toolbox</li>
<li>Double click to edit the task</li>
<li>Click New button next to Connection Dropdown</li>
<li>Select DynamoDB from Service Type. If you are connecting to Local DynamoDB then check DynamoDB Local option else enter your AWS Account Access Key and Secret Key to connect to Cloud Instance.
<div id="attachment_5386" style="width: 1147px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5386" class="size-full wp-image-5386" src="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection.png" alt="Create new Amazon DynamoDB Connection in SSIS  - Use Amazon DynamoDB Execute SQL Task - List Tables Example" width="1137" height="657" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection.png 1137w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection-300x173.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection-768x444.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-connect-amazon-dynamodb-executesql-task-local-live-connection-1024x592.png 1024w" sizes="(max-width: 1137px) 100vw, 1137px" /></a><p id="caption-attachment-5386" class="wp-caption-text">Create new Amazon DynamoDB Connection in SSIS &#8211; Use Amazon DynamoDB Execute SQL Task &#8211; List Tables Example</p></div></li>
<li>Click Test Connection to confirm and click OK to save Connection.</li>
<li>Back to ExecuteSQL Task UI, Click on Examples dropdown and select command like List Tables.</li>
<li>Click Test / Preview button.</li>
</ol>
<h3>Create DynamoDB Table Example</h3>
<p>Now lets look at how to create DynamoDB table in SSIS Amazon DynamoDB ExecuteSQL Task.</p>
<p>Change your Command Type Option to <strong>CreateTableSafe </strong>(Safe Suffix means, do not throw error if table already exists).</p>
<p>Enter the following Command and Click Test / Preview Result button to create new table called Customers. Primary Key for table is CustomerID.</p><pre class="crayon-plain-tag">{
    /*For more info visit : http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html */

    TableName: 'Customers',
    Wait : true, /* Wait until table status is ACTIVE */ 
    AttributeDefinitions: [
        /*Below two columns used in Composite Primary Key */
        {
            AttributeName: 'CustomerID',
            AttributeType: 'S'
        }
    ],
    KeySchema: [
        {
            AttributeName: 'CustomerID',
            KeyType: 'HASH'
        }
    ],
    ProvisionedThroughput: {
        ReadCapacityUnits: 5,
        WriteCapacityUnits: 5
    }
}</pre><p>
&nbsp;</p>
<h2>Write data to Amazon DynamoDB in SSIS</h2>
<p>Loading data into Amazon DynamoDB can be easily done using <a href="//zappysys.com/products/ssis-powerpack/ssis-dynamodb-destination/" target="_blank" rel="noopener">SSIS DynamoDB Destination Connector.</a> It supports loading data two different ways. You can insert Raw JSON documents or Masp individual columns too. Let&#8217;s look at both ways.</p>
<h3>Create Sample DynamoDB Table (via AWS Console)</h3>
<div></div>
<div>In the previous section, we mentioned how to create a DynamoDB Table using DynamoDB ExecuteSQL Task. If you want to learn how to create DynamoDB Table via Console then follow below steps. You can skip reading this section if you already created sample Customers table or know how this process works.</div>
<div>
<ol>
<li><a>In order to connect to Amazon DynamoDB from SSIS you will need Access Key and Secret Key. Ask your SysAdmin or responsible person to provide that to you. Your keys will look something like this: (<b>this is just example key which may differ in your case</b>)</a><br />
<pre class="crayon-plain-tag">AccessKey: AKIAIOSFODNN7EXAMPLE
SecretKey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY</pre>
<a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html" target="_blank" rel="noopener">Click here</a> to read more how to get your AccessKey and Secret Key</li>
<li>For this sample exercise we will need new DynamoDB table (with CustomerID column as HASH key, see below screenshots). To create new dynamoDB table perform following steps
<ul>
<li>Click on create table under DynamoDB console</li>
<li>On Primary Key screen give table name (e.g. Customer), Pick Key Type=HASH, enter keyname=CustomerID and click next<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-create-table.png" alt="Create Amazon DynamoDB Table for SSIS Testing - Primary Key HASH or RANGE" /></li>
<li>On index screen no need to enter anything for this exercise so just click next</li>
<li>On Read/Write throughput just enter 1 in both fields and click next<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-create-table-read-write-throughput.png" alt="Create Amazon DynamoDB Table for SSIS Testing - Read WRITE Throughput" /></li>
<li>Review and finalize table creation by clicking Create. It may take few minutes to provision DynamoDB table (Check for AVAILABLE status)<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-create-table-status-check.png" alt="Create Amazon DynamoDB Table for SSIS Testing - Verify Status" /></li>
</ul>
</li>
<li>Once you have created DynamoDB table, got Account Key (its like UserID) and Secret Key (its like password) you may proceed to next section.</li>
</ol>
</div>
<h3>Load data into DynamoDB (Column Mappings Mode)</h3>
<p>First lets look at how to load sample Customers data into DynamoDB Table using Simple column mapping mode.</p>
<div><a id="A_StepByStep"></a>In this section you will learn how to use Amazon DynamoDB Destination Adapter to write data to Amazon DynamoDB Table.</div>
<div></div>
<div>
<ol>
<li>From the SSIS toolbox drag and drop <i>Data Flow Task</i> on the control flow designer surface.</li>
<li>Double click on the Data Flow task to see Data Flow designer surface.</li>
<li>Right Click in Connection Manager Panel and select [New Connection&#8230;] menu item.
<div style="width: 268px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" title="Create new SSIS connection" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-pick-connection-type-click.png" alt="Create new SSIS connection" width="258" height="182" /><p class="wp-caption-text">Create new SSIS connection</p></div></li>
<li>Pick <strong>ZS-AWS-STORAGE</strong> connection type. On New Connection Dialogbox Select ServiceType from Top Dropdown, Enter AccessKey and SecrentKey and Click Test connection to verify credentials.<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-pick-connection-type.png" alt="Create SSIS Amazon DynamoDB Connection - Choose Type" /><br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-amazon-dynamodb-destination-configure-connection.png" alt="Configure SSIS Amazon DynamoDB Destination Connection" /></li>
<li>Click OK to save connection information.</li>
<li>From the SSIS toolbox drag and drop <a href="https://zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">ZS Dummy Data Source</a> on the dataflow designer surface.</li>
<li>Double click Dummy Data Source to configure it.</li>
<li>From Template pick Customer and enter row count=50 (For sample dataset has less than 100 unique values so lets pick small number).<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-aws-dynamodb-sample-data.png" alt="Configure SSIS Dummy Data Generator Source" /></li>
<li>From the SSIS toolbox drag and drop <i>Amazon DynamoDB Destination</i> on the dataflow designer surface.</li>
<li>Now single click on the Dummy Data Source, once you see blue arrow from source &#8230; connect it to DynamoDB Destination.</li>
<li>Now double click Amazon DynamoDB Destination to configure it.</li>
<li>On [Connection Manager] tab select DynamoDB connection manager.<br />
<img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-amazon-dynamodb-destination-select-adapter-connection.png" alt="Configure SSIS Amazon DynamoDB Destination Adapter - Connection Tab" /></li>
<li>Click on [Component Properties] tab and select AccessMode=Table and Pick DynamoDB table from Tables dropdown list.
<div style="width: 599px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-amazon-dynamodb-destination-select-table.png" alt="Configure SSIS Amazon DynamoDB Destination Adapter - Component Tab" width="589" height="527" /><p class="wp-caption-text">Configure SSIS Amazon DynamoDB Destination Adapter &#8211; Component Tab</p></div></li>
<li>Click on [Mappings] tab and verify mapping. If dynamoDB table is new table and its empty then all input columns will be automatically mapped. If DynamoDB table is existing table then you can manually pick mapping columns by dragging it from source list to target list.
<div style="width: 638px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-amazon-dynamodb-destination-select-mappings.png" alt="Configure SSIS Amazon DynamoDB Destination Adapter - Mapping Tab" width="628" height="572" /><p class="wp-caption-text">Configure SSIS Amazon DynamoDB Destination Adapter &#8211; Mapping Tab</p></div></li>
<li>Click OK to save settings.</li>
<li>Execute the package and verify target data by going to your AWS Console under DynamoDB section.
<div style="width: 282px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-dynamodb-write-data-sample.png" alt="Execute SSIS Amazon DynamoDB Destination Adapter - Load Data" width="272" height="175" /><p class="wp-caption-text">Execute SSIS Amazon DynamoDB Destination Adapter &#8211; Load Data</p></div></li>
<li>That&#8217;s it. Now you can go back to your AWS COnsole and verify inserted data in DynamoDB Table.
<div style="width: 812px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-dynamodb-console-verify-record-count.png" alt="SSIS Load Test - View DynamoDB Data in AWS Console - Record Count Check" width="802" height="371" /><p class="wp-caption-text">SSIS Load Test &#8211; View DynamoDB Data in AWS Console &#8211; Record Count Check</p></div></li>
</ol>
</div>
<div>
<h2></h2>
</div>
<h3>Insert JSON documents into DynamoDB (RAW Mode)</h3>
<p>Previous simple approach can be used if you have simple JSON structure in DynamoDB (i.e. no nested array). Now let&#8217;s look at how to create nested JSON documents and load into DynamoDB using RAW loading approach. With this method you can create nested JSON from multiple SQL Server tables or other sources (e.g. File, Oracle, MySQL, DB2).</p>
<p>You can use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/">JSON Generator Transform</a> or Template Transform to generate JSON documents in Data flow and then load into DynamoDB. <a href="https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/">Check these article to learn more on JSON Generator use cases</a>.</p>
<div><img decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-destination/ssis-dynamodb-insert-json-documents.png" alt="Amazon DynamoDB Data Load - Inserting Raw JSON Document" /></div>
<div></div>
<div>Video Tutorial &#8211; Creating Nested JSON for data loading</div>
<div></div>
<div>Below video tutorial was created for <a href="https://zappysys.com/blog/tag/mongodb/" target="_blank" rel="noopener">MongoDB</a> but concepts are almost identical for DynamoDB data loading.</div>
<div></div>
<div><a href="https://zappysys.com/blog/how-to-query-amazon-dynamodb-read-write-update/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FFkQjUahzMJQ%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></div>
<div></div>
<h2>Read from Amazon DynamoDB in SSIS</h2>
<p>Now lets move onto the next part &#8211; How to read data from DynamoDB in SSIS. DynamoDB is NoSQL database and it doesn&#8217;t have support for SQL Query language like any other RDBMS. But no worry.. If you using <a href="//zappysys.com/products/ssis-powerpack/ssis-dynamodb-source/" target="_blank" rel="noopener">SSIS DynamoDB Source Connector</a> then it supports custom SQL query language so it turns SQL into DynamoDB native API commands. This makes it super easy for any SQL Developer to use connector in drag and drop manner saving huge amount of time.</p>
<p>Let&#8217;s see how to read data from DyanmoDB Table</p>
<ol>
<li>Drag data flow</li>
</ol>
<h3>Specifying Options in WITH Clause of DynamoDB Query:</h3>
<ul>
<li>Specify SCAN mode using <em>SCAN</em> option<br />
<pre class="crayon-plain-tag">select * from mytable where SomeColumn &amp;gt; 55 WITH(SCAN)</pre>
</li>
<li>Specify SCAN mode with LIMIT of 1000 rows<br />
<pre class="crayon-plain-tag">select * from mytable where SomeColumn &amp;gt; 55 WITH(SCAN, LIMIT=1000)</pre>
</li>
<li>Specify QUERY mode using <em>QUERY</em> option<br />
<pre class="crayon-plain-tag">select * from mytable where MyHashKeyColumn = 'XYZ' And MyRangeKey &amp;gt; '1223' WITH(QUERY)</pre>
</li>
<li>Specify QUERY mode using <em>QUERY</em> option, and use of <em>INDEX</em><br />
<pre class="crayon-plain-tag">select * from mytable where MyHashKeyColumn = 'XYZ' And MyRangeKey &amp;gt; '1223' and Phone LIKE '111-%' WITH(QUERY, INDEX=idxPhone)</pre>
</li>
</ul>
<h3>Query Amazon DynamoDB with Date/Time column</h3>
<p>There is no Datetime datatype in DynamoDB but if you are storing your date values in <a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener">ISO 8601 DateTime Format</a> as string then your query will understand automatically if you specify &gt;<em>, &gt;=, &lt;, &lt;= or BETWEEN</em> Filter Condition</p><pre class="crayon-plain-tag">select * from Orders where OrderDate &gt; '2015-12-31T23:59:59.000Z' WITH(SCAN)</pre><p>
<h3>Using SSIS variable to query DynamoDB Date/Time column</h3>
<p>If you want to make your query dynamic then you can use SSIS variable placeholder (use quote around it). If your variable DataType is datetime then you can format it using following way so it has ISO date format. If your variable DataType is String then make sure its correctly formatted.</p><pre class="crayon-plain-tag">select * from Orders where OrderDate &gt; '{{User::vMyDate,yyyy-MM-ddTHH:mm:ssZ}}' WITH(SCAN)</pre><p>
<a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener">Click here to see various ISO date formats</a></p>
<h3>Amazon DynamoDB Query Examples (DynamoDB Filter) :</h3>
<pre class="crayon-plain-tag">-- Selecting all columns 
select * from CustomerTest

-- Selecting multiple columns 
select CustomerID,CompanyName from CustomerTest

-- Selecting multiple columns, where some attribute name has space in it
select CustomerID,[Contact Title] from CustomerTest

-- Find records where City attribute is missing (Missing is different than actual NULL value {City: null, Id:1} -vs- {Id:1} )

select * from CustomerTest Where City IS  NULL 
-- Find records where City attribute is NULL (i.e. attribute is found but value is NULL e.g. {City: null, Id:1} )

select * from CustomerTest Where City =  NULL 

-- Using Where clause with simple condition, select all columns
select * from CustomerTest Where CustomerID='ALC3R'

-- Limiting records returned from query using TOP clause (Similar as LIMIT found in some RDBMS query engine)
select top 7 * from CustomerTest

-- Using OR  
select * from CustomerTest Where CustomerID = 'ALFKI' OR CustomerID = 'BOLID'

-- Using AND  
select * from CustomerTest Where CustomerID = 'ALFKI' AND Age &gt;
 3

-- Using comparison operators 
select * from CustomerTest Where CustomerID &lt;&gt; 'ALFKI'

select * from CustomerTest Where CustomerID != 'ALFKI'

select * from CustomerTest Where Age &gt; 5

select * from CustomerTest Where Age &gt;= 5

select * from CustomerTest Where Age &lt; 5

select * from CustomerTest Where Age = 5 AND CustomerID = 'C5'</pre>
&nbsp;</p>
<h2>Amazon DynamoDB Source Connector Screenshots</h2>
<h3>Amazon DynamoDB Source &#8211; Configure Connection</h3>
<p><img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-configure-connection.png" alt="SSIS Amazon DynamoDB Source Connector General Settings" /></p>
<div>
<h3>Amazon DynamoDB Source &#8211; Query DynamoDB using SQL language</h3>
<p><img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-settings.png" alt="SSIS Amazon DynamoDB Source Connector - Query DynamoDB using SQL language" /></p>
</div>
<div>
<h3>Query Amazon DynamoDB &#8211; Read from Table Mode</h3>
<div style="width: 541px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-table-data-preview.png" alt="SSIS Amazon DynamoDB Source - Read from Table" width="531" height="349" /><p class="wp-caption-text">Query Amazon DynamoDB &#8211; Read from Table Mode</p></div>
</div>
<div>
<h3>Amazon DynamoDB Source &#8211; Select Columns</h3>
<div style="width: 660px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-select-columns.png" alt="SSIS Amazon DynamoDB Source Connector - Select Columns" width="650" height="480" /><p class="wp-caption-text">Amazon DynamoDB Source &#8211; Select Columns</p></div>
</div>
<div>
<h3>Query Amazon DynamoDB &#8211; Read from nested array using JSON Path</h3>
<div style="width: 762px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-dynamodb-extract-array-read-json-documents-jsonpath.png" alt="SSIS Amazon DynamoDB Source Connector - Read from nested array using JSON Path" width="752" height="530" /><p class="wp-caption-text">Query Amazon DynamoDB &#8211; Read from nested array using JSON Path</p></div>
</div>
<div>
<h3>Query Amazon DynamoDB &#8211; Advanced JSON Filter Options</h3>
<p><img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-dynamodb-extract-array-read-json-documents-jsonpath-options.png" alt="SSIS Amazon DynamoDB Source Connector - Advanced JSON Filter Options" /></p>
</div>
<div>
<h3>Query Amazon DynamoDB &#8211; Extract RAW JSON documents</h3>
<p><img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-extract-json-documents-raw-mode.png" alt="SSIS Amazon DynamoDB Source Connector - Amazon DynamoDB Source - Extract RAW JSON documents" /></p>
</div>
<div>
<h3>Amazon DynamoDB Source &#8211; Extract data from DynamoDB</h3>
<p><img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-source/ssis-amazon-dynamodb-source-extract-data-sample.png" alt="SSIS Amazon DynamoDB Source Connector - Extract data from DynamoDB" /></p>
<h2></h2>
<h2>Update Documents in DynamoDB</h2>
<p>Now let&#8217;s look at how to Update Documents in DynamoDB. Amazon DynamoDB does not allow Bulk Update so you have to do row by row processing. You have to submit UpdateItem Command as per <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html" target="_blank" rel="noopener">this document</a>. We will update Document for matching condition and update specific columns in this example. By default Document is matched By Key unless you supply additional Condition in the command (e.g. &#8220;ConditionExpression&#8221;: &#8220;LastPostedBy = :val2&#8221; ) .</p>
<ol>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">ZS Dummy Data Source</a> and configure like previous section with Customers Template. You can also use OLEDB Source for read DB data.</li>
<li>Now drag <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-template-transform.htm">ZS Template Transform</a>. You can enter command  like below to match record by Key and Update CompanyName and Phone fields (for demo we added -MY-NEW suffix in the data )<br />
<pre class="crayon-plain-tag">{
    "TableName": "Customers",
    "Key": { "CustomerID": { "S": "&lt;%CustomerID%&gt;" } },
    "UpdateExpression": "set CompanyName = :val1, Phone = :val2",
    "ExpressionAttributeValues": {
        ":val1": {"S": "&lt;%CompanyName,JSONENCODE%&gt;-MY-NEW"},
        ":val2": {"S": "&lt;%Phone,JSONENCODE%&gt;-MY-NEW"}
    }
}</pre>
If you have multi Key then use like this (e.g. CustomerID + ProductID )<br />
<pre class="crayon-plain-tag">"Key": { "CustomerID": { "S": "&lt;%CustomerID%&gt;" } ,  "ProductID": { "S": "&lt;%ProductID%&gt;" }   },</pre>
Also you can add additional condition on the top of Key JOIN criteria like below (e.g. Match Country too)<br />
<pre class="crayon-plain-tag">{
    "TableName": "Customers",
    "Key": { "CustomerID": { "S": "&lt;%CustomerID%&gt;" } },
    "UpdateExpression": "set CompanyName = :val1, Phone = :val2",
    "ConditionExpression": "Country = :val3",
    "ExpressionAttributeValues": {
        ":val1": {"S": "&lt;%CompanyName,JSONENCODE%&gt;-MY-NEW"},
        ":val2": {"S": "&lt;%Phone,JSONENCODE%&gt;-MY-NEW"},
        ":val3": {"S": "&lt;%Country,JSONENCODE%&gt;"}
    }
}</pre>
&nbsp;</p>
<div id="attachment_5387" style="width: 960px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-dynamodb-update-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5387" class="size-full wp-image-5387" src="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-dynamodb-update-example.png" alt="Update Amazon DynamoDB Table - Use SSIS Template Transform" width="950" height="586" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-dynamodb-update-example.png 950w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-dynamodb-update-example-300x185.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-dynamodb-update-example-768x474.png 768w" sizes="(max-width: 950px) 100vw, 950px" /></a><p id="caption-attachment-5387" class="wp-caption-text">Update Amazon DynamoDB Table &#8211; Use SSIS Template Transform</p></div></li>
<li>Connect Template Transform to ZS DynamoDB Destination</li>
<li>Now drag ZS Amazon DynamoDB Destination
<ol>
<li>On first tab Select Connection</li>
<li>On second tab Change Action to <strong>Update</strong>, Select Table as <strong>Customers</strong></li>
<li>On Mappings tab Map <strong>TemplateOutput</strong> column to <strong>__DOCUMENT__</strong> column. Remove any other mappings. If you dont see columns in Target just click Refresh.</li>
</ol>
</li>
<li>Thats it now run Data flow to Update records. AFter execution you can review updated records in DynamoDB.</li>
</ol>
<h2>Call/Execute Ad-Hoc DynamoDB commands</h2>
<p>Sometimes you have need to call ad-hoc Amazon DynamoDB commands which are different than read/write. For that you can use <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-dynamodb-executesql-task/" target="_blank" rel="noopener">Amazon DynamoDB ExecuteSQL Task</a>.</p>
<div style="width: 710px" class="wp-caption alignnone"><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-executesql-task/ssis-amazon-dynamodb-create-table-request.png"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-dynamodb-executesql-task/ssis-amazon-dynamodb-create-table-request.png" alt="Call Amazon DynamoDB API Commands (Create/Drop Table, Get, Put)" width="700" /></a><p class="wp-caption-text">Call Amazon DynamoDB API Commands (Create/Drop Table, Get, Put)</p></div>
<h2>Conclusion</h2>
<p>Amazon DynamoDB is one of the most popular Managed NoSQL database in cloud at fraction of cost of traditional RDBMS. Extracting/Writing/Updating data into DynamoDB can be challenge without right toolset. ZappySys AWS Connectors/Tasks makes it super easy for various AWS Integration scenarios (S3, Redshift, DynamoDB, JSON, Redshift etc). Try <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack for FREE</a> to uncover many more things you can do.</p>
</div>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/how-to-query-amazon-dynamodb-read-write-update/">How to Read / Write Amazon DynamoDB in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Ways to Export JSON from SQL Server using SSIS</title>
		<link>https://zappysys.com/blog/export-json-from-sql-server-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 07 Dec 2015 19:38:44 +0000</pubDate>
				<category><![CDATA[SSIS JSON Export Task]]></category>
		<category><![CDATA[SSIS JSON File Destination]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS Logging Task]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS Export JSON Task]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=209</guid>

					<description><![CDATA[<p>Introduction SQL Server 2012 and all previous versions lacking native JSON support, same theory is true for their ETL Platform SSIS. If you are one of them who wants to export JSON from SQL Server or any other RDBMS like MySQL, Oracle then you can easily output complex JSON using any of the following components. Five ways of [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/export-json-from-sql-server-using-ssis/">5 Ways to Export JSON from SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>SQL Server 2012 and all previous versions lacking native JSON support, same theory is true for their ETL Platform SSIS. If you are one of them who wants to export JSON from SQL Server or any other RDBMS like MySQL, Oracle then you can easily output complex JSON using any of the following components.</p>
<h2>Five ways of creating JSON inside SSIS</h2>
<p>ZappySys toolset provides multiple ways creating JSON inside SSIS. You can choose method suitable for your scenario. Each method has pros and cons so choose it as per your need.</p>
<h3>JSON File Destination</h3>
<p><img decoding="async" class="alignleft" style="font-family: inherit; font-size: inherit;" title="SSIS JSON Destination (Create JSON File)" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-file-destination/ssis-json-file-destination.png" alt="SSIS JSON Destination (Create JSON File)" width="100" /><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" target="_blank" rel="noopener">SSIS JSON Destination</a> can be used to generate simple or complex JSON files out of relational data source such as SQL Server, Oracle, MySQL. In few clicks you can create desired JSON Shape from single or multiple tables (Parent/Child Nested Documents).</p>
<p><strong>PROS:</strong> Multiple data flow components can be attached. Which means unlike <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a> you are not limited to OLEDB or ODBC Sources only.</p>
<p><strong>CONS:</strong> When you remove upstream component it may break Dataset mappings. Also server side Lookup Option is not available. File Splitting Options not available.</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-json-file-destination/" target="_blank" rel="noopener">some articles</a> for use case of this component.</p>
<div id="attachment_5358" style="width: 943px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5358" class="size-full wp-image-5358" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png" alt="JSON File Destination - Generate JSON in SSIS from multiple inputs" width="933" height="784" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png 933w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-768x645.png 768w" sizes="(max-width: 933px) 100vw, 933px" /></a><p id="caption-attachment-5358" class="wp-caption-text">JSON File Destination &#8211; Generate JSON in SSIS from multiple inputs</p></div>
<h3>JSON Generator Transform</h3>
<h3><span style="font-size: 16px;"><img decoding="async" class="alignleft" title="JSON Generator Transform" src="https://zappysys.com/images/SSIS-PowerPack/ssis-json-generator-transform.png" alt="JSON Generator Transform" width="100" /></span></h3>
<p><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> can be used to generate single or multiple JSON documents from any type of data sources (e.g. SQL Server, MySQL, Flat File, Excel) inside data flow task. It takes multiple inputs and outputs JSON String Output Column which can be used to feed JSON to other downstream system.</p>
<p><strong>PROS:</strong> Multiple data flow components can be attached. Which means unlike <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a> you are not limited to OLEDB or ODBC Sources only.</p>
<p><strong>CONS:</strong> When you remove upstream component it may break Dataset mappings. Also server side Lookup Option is not available. File Splitting Options not available. Output is JSON String Column.</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/" target="_blank" rel="noopener">some articles</a> for use case of this transform.</p>
<div id="attachment_4918" style="width: 792px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4918" class="size-full wp-image-4918" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png" alt="Preview JSON - Generate for BigQuery Table Insert" width="782" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png 782w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert-300x246.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert-768x629.png 768w" sizes="(max-width: 782px) 100vw, 782px" /></a><p id="caption-attachment-4918" class="wp-caption-text">Preview JSON &#8211; Generate for BigQuery Table Insert</p></div>
<h3>Export JSON Task</h3>
<p><em><img decoding="async" class="alignleft" src="https://zappysys.com/images/SSIS-PowerPack/ssis-export-json-file-task.png" alt="SSIS Export JSON File Task" /></em><a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">SSIS Export JSON File Task</a> can be used to generate simple or complex JSON files out of relational data source such as SQL Server, Oracle, MySQL. It also support exporting directly to cloud (e.g. Azure Blob Storage, Amazon AWS S3, Secure FTP). In few clicks you can create desired JSON Shape from single or multiple tables (Parent/Child Nested Documents)</p>
<p><strong>PROS:</strong> Simple to use with flexible options to export to file, variable, AWS S3, Azure Blob, FTP / SFTP location. Allows to split records. File Splitting Options available (Split By Size  / Row Count).</p>
<p><strong>CONS:</strong> You can only use limited data sources as Dataset input (e.g. OLEDB / ODBC or SQL Server).</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-json-export-task/" target="_blank" rel="noopener">some articles</a> for use case of this task.</p>
<h3>Template Transform</h3>
<p><img decoding="async" class="alignleft" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/template-transform/ssis-template-transform.png" alt="SSIS SSIS Template Transform" />Template Transform can be used to create dynamic strings inside data flow. You can use upstream columns as placeholders or use SSIS variables anywhere in the template to create desired text (e.g. XML / JSON document).</p>
<p><strong>PROS:</strong> Very Simple to use.</p>
<p><strong>CONS:</strong> Cannot use multiple inputs. It may not be used to create Complex JSON and options like do not output NULL attributes is not possible.</p>
<p>&nbsp;</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-template-transform/" target="_blank" rel="noopener">some articles</a> for use case of this transform.</p>
<div id="attachment_2614" style="width: 983px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2614" class="size-full wp-image-2614" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png" alt="Create JSON for API Request (POST) using SSIS Template Transform" width="973" height="611" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png 973w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-768x482.png 768w" sizes="(max-width: 973px) 100vw, 973px" /></a><p id="caption-attachment-2614" class="wp-caption-text">Create JSON for API Request (POST) using SSIS Template Transform</p></div>
<h3>Logging Task (Control Flow Approach)</h3>
<p><img decoding="async" class="alignleft" src="https://zappysys.com/images/SSIS-PowerPack/ssis-logging-task.png" /> Just like Template Transform you can use <a href="https://zappysys.com/products/ssis-powerpack/ssis-logging-task-free/" target="_blank" rel="noopener">ZS Logging Task</a> to create JSON string from Template and Variable Placeholders.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Here is how to use Logging Task to save JSON into a variable.</p>
<ol>
<li>Select Variable which you like to Set on Logging Task</li>
<li>Enter your Template JSON String which you like to produce (see example below). Notice the use of yyyy-MM-dd <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">format specifier</a> and also JSONENCODE function.<br />
<pre class="crayon-plain-tag">{
 ActionId: {{User::vActionId}},
 CreatedOn: "{{User::vOrderDate,yyyy-MM-ddTHH:mm:ss}}",
 Notes: "{{User::vNotes,JSONENCODE}}"
}</pre>
</li>
<li>Select Message Type = <strong>None</strong></li>
<li><strong>Uncheck Append</strong>, and <strong>Prefix</strong> options like below
<div id="attachment_222" style="width: 732px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-222" class="wp-image-222 size-full" src="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png" alt="Creating JSON / XML Document using SSIS Logging Task" width="722" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png 722w, https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder-300x219.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-222" class="wp-caption-text">Creating JSON / XML Document using SSIS Logging Task</p></div></li>
</ol>
<p>&nbsp;</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-logging-task/" target="_blank" rel="noopener">some articles</a> for use case of this task.</p>
<p>&nbsp;</p>
<h2>Create JSON using SSIS Export JSON Task</h2>
<p>Now let&#8217;s look at Export JSON Task form example to create JSON. Steps listed in below sections are very similar to JSON File Destination or JSON Generator Transform.</p>
<p>ZappySys offers innovative Layout Editor for JSON / XML creation from multiple sources. You can use Layout Editor to produce desired JSON Layout (Layout is stored in XML format behind the scene) and then in later step you will see how to make it dynamic so values are changed at runtime.</p>
<p>You can read layout as direct value, read from variable or read from file from disk.</p>
<h3>Select source connection for data</h3>
<p>First lets create new OLEDB or ADO.net connection from where we will read data. In our case we reading from Northwind Database.</p>
<div id="attachment_216" style="width: 565px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-216" class="size-full wp-image-216" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png" alt="SSIS JSON Export Task - Select Source Database Connection" width="555" height="218" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png 555w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection-300x118.png 300w" sizes="(max-width: 555px) 100vw, 555px" /></a><p id="caption-attachment-216" class="wp-caption-text">SSIS JSON Export Task &#8211; Select Source Database Connection</p></div>
<h3>Create Datasets</h3>
<p>Now add datasets which will be used to produce JSON File. One dataset will be always Root Dataset (Example: If your Root information is about customer then select customer table or query as your Main dataset. All other sections will be child sections)</p>
<div id="attachment_215" style="width: 419px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-215" class="size-full wp-image-215" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png" alt="Add SQL Dataset - Export JSON from SQL Query Option" width="409" height="431" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png 409w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset-285x300.png 285w" sizes="(max-width: 409px) 100vw, 409px" /></a><p id="caption-attachment-215" class="wp-caption-text">Add SQL Dataset &#8211; Export JSON from SQL Query Option</p></div>
<h3>Add Output Columns for Main JSON Document</h3>
<p>Now its time to add columns for our output. If * is added by default then remove. * means output all columns. When you add columns first make sure you select correct parent node under which you want to add columns. In our case &#8220;Mappings&#8221; is parent node.</p>
<div id="attachment_214" style="width: 391px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-214" class="size-full wp-image-214" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png" alt="Add Output Columns for JSON Document - Column Selection Screen" width="381" height="446" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png 381w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns-256x300.png 256w" sizes="(max-width: 381px) 100vw, 381px" /></a><p id="caption-attachment-214" class="wp-caption-text">Add Output Columns for JSON Document &#8211; Column Selection Screen</p></div>
<h3>Add JSON Array / JOIN Conditions for related document</h3>
<p>Now let&#8217;s look at how to add JSON Array. For example Customer may have one or more Orders so we need to add node called Orders which may Produce JSON fragment like below</p>
<pre class="crayon-plain-tag">Orders : [ {...} , {...} ] </pre>
<p>Once customer related columns added, its time to add Orders section.</p>
<ol>
<li>This is Array of documents so first highlight &#8220;Mappings&#8221; node</li>
<li>Click &#8220;Add Document Array&#8221; option from toolbar.</li>
<li>On Add/Edit Elements UI specify name for JSON Attribute and specify correct relationship to parent dataset. In our case Orders related to Customers using CustomerID key.</li>
</ol>
<div id="attachment_212" style="width: 548px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-212" class="size-full wp-image-212" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png" alt="Add Child Section - nested JSON document , Define Parent-Child Relationship" width="538" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png 538w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation-300x241.png 300w" sizes="(max-width: 538px) 100vw, 538px" /></a><p id="caption-attachment-212" class="wp-caption-text">Add Child Section &#8211; nested JSON document , Define Parent-Child Relationship</p></div>
<h3>Handling JSON Array with dummy root dataset (Multiple Arrays)</h3>
<p>So in previous section we saw how to add array and define JOIN condition with parent dataset. Now what if you really have no parent dataset to join with ? For example we need to produce following sample JSON where Order array is related to Customer by common Column CustomerID as JOIN column. But Customer is not bound with any parent column. So how do you define JOIN condition? In such case you have to use below technique called dummy root dataset. (See next section on how to handle only one dataset using <strong>Single Dataset Array Mode</strong>)</p>
<p><strong>Sample JSON (Dummy root pattern)</strong></p><pre class="crayon-plain-tag">{
    "Customers": [
      {
        "CustomerID": "ALFKI",
        "CompanyName": "Alfreds Futterkiste",
        "Orders": [
          {
            "OrderID": 1000,
            "OrderDate": "2015-12-01"
          },
          {
            "OrderID": 1001,
            "OrderDate": "2015-12-01"
          }
        ]
      },

      {
        "CustomerID": "ANATR",
        "CompanyName": "Ana Trujillo Emparedados y helados",
        "Orders": [
          {
            "OrderID": 1002,
            "OrderDate": "2015-12-01"
          },
          {
            "OrderID": 1003,
            "OrderDate": "2015-12-01"
          }
        ]
      }

    ]
  }
}</pre><p>
Since root level always needs dataset, we must provide dummy dataset (only one row) even though there is no need for Parent Dataset JOIN in Customer Array. Typically you can write query like below to product dummy row in SQL Server or other database using OLEDB Source or Use <a href="https://zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">Dummy Data Source</a> with Max Rows=1 setting to produce one fake record.</p><pre class="crayon-plain-tag">SELECT 1 as Col1</pre><p>
<strong>Using Dummy DataSource as Input</strong></p>
<p>For generating JSON which needs dummy root. Perform the following steps</p>
<ol>
<li>Drag Dummy Data Source from SSIS Toolbox. Change <strong>How many rows</strong> to 1. Click OK</li>
<li>Now drag two more OLEDB sources and Configure (e.g. Customers and Orders)</li>
<li>Now drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/">ZS JSON FIle Destination</a> component or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/">ZS JSON Generator</a></li>
<li>Now connect Dummy datasource then Customers and then Orders</li>
<li>Double click JSON component to configure layout. You may notice that Dummy Input is set as Root by default.</li>
<li>You can now select Mappings node and click on Add Array Documents icon. Configure like below. Notice we have not selected any JOIN criteria because its joined with Dummy Root.
<div id="attachment_5357" style="width: 785px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5357" class="size-full wp-image-5357" src="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png" alt="Add array to join with dummy dataset" width="775" height="617" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png 775w, https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export-300x239.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export-768x611.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></a><p id="caption-attachment-5357" class="wp-caption-text">Add array to join with dummy dataset</p></div></li>
<li>Now select newly added node and Click Add column icon to add CustomerID, CompanyName column under Customers array</li>
<li>Now select Customers array node and click Array Documents icon to Add Orders array.</li>
<li>Once Orders Array ia added you can Select Orders node and Insert new element to add OrderID and OrderDate columns</li>
<li>Finally it will look like below
<div id="attachment_5358" style="width: 943px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5358" class="size-full wp-image-5358" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png" alt="JSON File Destination - Generate JSON in SSIS from multiple inputs" width="933" height="784" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png 933w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-768x645.png 768w" sizes="(max-width: 933px) 100vw, 933px" /></a><p id="caption-attachment-5358" class="wp-caption-text">JSON File Destination &#8211; Generate JSON in SSIS from multiple inputs</p></div></li>
</ol>
<p>&nbsp;</p>
<h3>Single dataset used as array</h3>
<p>Now lets look at one more pattern just like described in the previous section but now we have just one nested level (Only customers and not using Orders). If you have such case then choose Single dataset pattern option in the output mode. On Export Task you may see as check box rather than dropdown. To produced desired JSON (see blow) perform these steps.</p>
<ol>
<li>Select Output mode as <strong>Single Dataset Array</strong></li>
<li>In your Layout builder click on <strong>Add Document Array</strong> Icon and name it &#8220;Customers&#8221;.</li>
<li>After that highlight newly added node &gt; Right-Click &gt; <strong>Add Elements</strong> under that node</li>
<li>That&#8217;s it you will now see preview like below.</li>
</ol>
<pre class="crayon-plain-tag">{
    "Customers": [
      {
        "CustomerID": "ALFKI",
        "CompanyName": "Alfreds Futterkiste"
      },

      {
        "CustomerID": "ANATR",
        "CompanyName": "Ana Trujillo Emparedados y helados"
      }
    ]
  }
}</pre>
&nbsp;</p>
<h3>How to export JSON in 2D Array format</h3>
<p>If you have to export JSON as 2D array format then you can change following option.</p>
<p><img decoding="async" class="figureimage" title="SSIS Export to JSON File Task - Export as 2D Array" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/export-json-file-task/ssis-export-json-2d-array-format.png" alt="SSIS Export JSON File Task - Export as 2D Array" /></p>
<p>Here are examples of output for each option.<br />
Select say you have source data with 2 columns <i>id</i> and <i>name</i>.</p>
<p><b>Default</b></p><pre class="crayon-plain-tag">[{id:1,name:&quot;AA&quot;}, {id:2,name:&quot;BB&quot;}]</pre><p>
<b>Multicontent</b></p><pre class="crayon-plain-tag">{id:1,name:&quot;AA&quot;}{id:2,name:&quot;BB&quot;}</pre><p>
<b>ArrayDocs</b></p><pre class="crayon-plain-tag">[{id:1,name:&quot;AA&quot;}, {id:2,name:&quot;BB&quot;}]</pre><p>
<b>Array2D</b></p><pre class="crayon-plain-tag">[[1,&quot;AA&quot;],[2,&quot;BB&quot;]]</pre><p>
<b>Array2DWithHeader</b></p><pre class="crayon-plain-tag">[[&quot;id&quot;,&quot;name&quot;],[1,&quot;AA&quot;],[2,&quot;BB&quot;]]</pre><p>
<b>ArrayLines</b></p><pre class="crayon-plain-tag">[1,&quot;AA&quot;][2,&quot;BB&quot;]</pre><p>
<b>ArrayLinesWithHeader</b></p><pre class="crayon-plain-tag">[&quot;id&quot;,&quot;name&quot;][1,&quot;AA&quot;][2,&quot;BB&quot;]</pre><p>
&nbsp;</p>
<h3>Preview JSON output using live preview</h3>
<p>You can enable / disable Live preview of JSON layout as below.</p>
<div id="attachment_210" style="width: 573px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-210" class="size-full wp-image-210" src="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png" alt="JSON Output preview in SSIS Export JSON File Task" width="563" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png 563w, https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis-300x253.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></a><p id="caption-attachment-210" class="wp-caption-text">JSON Output preview in SSIS Export JSON File Task</p></div>
<h2>Make things dynamic (Using SSIS Variable for SQL or Layout)</h2>
<p>There will be a time when you have use dynamic values in your JSON generation. You may have to Alias something from variable or you have to supply Variable in your SQL used for Dataset. Not to worry. ZappySys Supports multiple ways to make it dynamic. You can use SSIS Variables following 3 ways to make Layout XML dynamic.</p>
<ol>
<li>Use SSIS variable inside Dataset SQL (Only for <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">ZS Export JSON Task</a>)</li>
<li>Anywhere inside Layout XML (Click <strong>Edit Code</strong> option)</li>
<li>Load Layout From Variable (Indirect Method)</li>
</ol>
<h3>Using Variable inside Dataset SQL</h3>
<p>Here is how you can use Variable inside dataset SQL for <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">ZS Export JSON Task</a></p>
<div id="attachment_5359" style="width: 736px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5359" class="size-full wp-image-5359" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png" alt="SSIS Export JSON Task - Using Variable for Dynamic SQL" width="726" height="538" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png 726w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable-300x222.png 300w" sizes="(max-width: 726px) 100vw, 726px" /></a><p id="caption-attachment-5359" class="wp-caption-text">SSIS Export JSON Task &#8211; Using Variable for Dynamic SQL</p></div>
<h3>Using Variable inside Layout XML</h3>
<p>Here is how you can insert SSIS Variable anywhere in Layout XML. In below Example we are choosing Alias for one column from some SSIS Variable.</p>
<div id="attachment_5360" style="width: 865px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5360" class="size-full wp-image-5360" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png" alt="SSIS JSON File Destination - Using SSIS Variable for Dynamic Layout" width="855" height="591" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png 855w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout-300x207.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout-768x531.png 768w" sizes="(max-width: 855px) 100vw, 855px" /></a><p id="caption-attachment-5360" class="wp-caption-text">SSIS JSON File Destination &#8211; Using SSIS Variable for Dynamic Layout</p></div>
<h3>Load Layout From Variable</h3>
<p>If you have some need to load Layout XML from File or SSIS Variable. You can use Load Layout from Variable Option.</p>
<p>For example in below screenshot we are creating layout first and ave to some variable. Or you can load from external file using <a href="https://zappysys.com/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a>.  Connect Logging task to Export JSON Task and you ready to produce JSON.</p>
<div id="attachment_222" style="width: 732px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-222" class="size-full wp-image-222" src="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png" alt="Set SSIS Variable value (multi-line content using placeholder)" width="722" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png 722w, https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder-300x219.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-222" class="wp-caption-text">Set SSIS Variable value (multi-line content using placeholder)</p></div>
<p>Here is how to load Layout From any SSIS Variable. You can also load Layout from XML file or Variable which contains layout File Path.</p>
<div id="attachment_210" style="width: 573px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-210" class="wp-image-210 size-full" src="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png" alt="JSON Layout from SSIS Variable" width="563" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png 563w, https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis-300x253.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></a><p id="caption-attachment-210" class="wp-caption-text">JSON Layout from SSIS Variable</p></div>
<h2>Other JSON Output Options</h2>
<p>Execute package and verify generated JSON it should look like below (Date format may be different in your case if you have set different on JSON options tab). For clarity we have formatted JSON below but in your output it may be compact version so reduce file size.</p>
<h3>Indent JSON Output</h3>
<p>You can check Indent option to make JSON look pretty like below.</p><pre class="crayon-plain-tag">{
  "CustomerID": "ALFKI",
  "CompanyName": "Alfreds Futterkiste",
  "ContactName": null,
  "Orders": [
    {
      "OrderID": 10643,
      "OrderDate": "1997-08-25T00:00:00"
    },
    {
      "OrderID": 10692,
      "OrderDate": "1997-10-03T00:00:00"
    },
    {
      "OrderID": 10702,
      "OrderDate": "1997-10-13T00:00:00"
    },
    {
      "OrderID": 10835,
      "OrderDate": "1998-01-15T00:00:00"
    },
    {
      "OrderID": 10952,
      "OrderDate": "1998-03-16T00:00:00"
    },
    {
      "OrderID": 11011,
      "OrderDate": "1998-04-09T00:00:00"
    }
  ]
}</pre><p>
<h3>Hide NULL Attribute Option</h3>
<p>There will be a time when you want to Hide NULL attribute rather than showing <strong>MyAttr: null</strong> this is also possible by checking Hide NULL Attribute Option on Options Tab.</p>
<h2>Export JSON to Amazon S3, Azure Blob, Secure FTP (SFTP / FTPS)</h2>
<p>Export JSON Task support some really good options to save file to other than local file system. If you want to export JSON directly to Amazon / Azure Cloud or FTP Server without saving to local disk then you can use Azure / FTP / Amazon Connection Manager on Target Tab of Export JSON Task. This option is only available for <strong>PRO Edition</strong> Users.</p>
<div style="width: 666px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/export-json-file-task/ssis-export-sql-tables-to-json-file-azure-blob-amazon-s3-secure-ftp-split-gzip-compress.png" alt="Export JSON / CSV / XML Files to Azure Blob, Amazon S3, Secure FTP Storage" width="656" height="440" /><p class="wp-caption-text">Export JSON / CSV / XML Files to Azure Blob, Amazon S3, Secure FTP Storage</p></div>
<h2>Conclusion</h2>
<p>If you want to output JSON from SQL Server or any other relational DB then its not simple task in SSIS specially when you have nested JSON documents (e.g. Customer-&gt;Orders). In this post you have seen how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/">SSIS JSON Export Task</a> to generate nested JSON from multiple datasets.</p>
<p>The post <a href="https://zappysys.com/blog/export-json-from-sql-server-using-ssis/">5 Ways to Export JSON from SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
