<?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>nosql Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/nosql/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/nosql/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 14 Nov 2018 18:10:37 +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>nosql Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/nosql/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 fetchpriority="high" 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 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 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>How to Insert Multiple Documents into MongoDB using SSIS</title>
		<link>https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 00:55:05 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[BSON]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS MongoDB ExecuteSQL Task]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=634</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to use MongoDB ExecuteSQL Task for SSIS to insert multiple documents into MongoDB collection using SSIS. This task can be used to perform any DDL or DML operations for MongoDB natively inside SSIS without using any command line utilities. It gives you flexibility and security of SSIS. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/">How to Insert Multiple Documents into MongoDB using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><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" />In this post you will learn how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task for SSIS</a> to <em>insert multiple documents into MongoDB collection</em> using SSIS. This task can be used to perform any DDL or DML operations for MongoDB natively inside SSIS without using any command line utilities. It gives you flexibility and security of SSIS.</p>
<p>&nbsp;</p>
<h2>Step-By-Step &#8211; Insert Multiple Documents into MongoDB Collection using SSIS</h2>
<p>Lets look at how to insert multiple MongoDB documents into</p>
<ol>
<li>Download SSIS PowerPack from here</li>
<li>Create new SSIS Package</li>
<li>Drag ZS MongoDB ExecuteSQL Task from SSIS Toolbox</li>
<li>Double click task to configure</li>
<li>Create new MongoDB connection by clicking on [New] button next to connection dropdown</li>
<li>Click OK to close connection UI</li>
<li>Now you can enter following Command in MongoDB ExecuteSQL Task to insert multiple documents into MongoDB. If you want to pass json stored inside SSIS variable then use variable placeholders (e.g. {{User::varMyJson}}  ) anywhere inside below command.<br />
<pre class="crayon-plain-tag">{
 scope: 'database',
 db: 'DemoDB',
 command: 'eval',
 args: { code: 'db.MyCollection.insert( [ {ID:1,Name:"AAA"}, {ID:2,Name:"BBB"} ] )' } 
}</pre>
</li>
</ol>
<div id="attachment_686" style="width: 814px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-686" class="size-full wp-image-686" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png" alt="Insert multiple documents in MongoDB Collection (JSON or BSON format)" width="804" height="567" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png 804w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json-300x212.png 300w" sizes="(max-width: 804px) 100vw, 804px" /></a><p id="caption-attachment-686" class="wp-caption-text">Insert multiple documents in MongoDB Collection (JSON or BSON format)</p></div>
<h2>Conclusion</h2>
<p>Using <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task for SSIS</a> you can execute ad-hoc MongoDB Shell commands without installing any command line tools. This is totally native SSIS approaching. You can Try <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack for FREE</a> to find out many more MongoDB features not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/">How to Insert Multiple Documents into MongoDB using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS &#8211; Loading data into MongoDB (Upsert, Delete, Update)</title>
		<link>https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 26 Feb 2016 22:03:21 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Destination]]></category>
		<category><![CDATA[export json task]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis connectors]]></category>
		<category><![CDATA[SSIS Dummy Data Source]]></category>
		<category><![CDATA[SSIS Export JSON Task]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS MongoDB ExecuteSQL Task]]></category>
		<category><![CDATA[SSIS MongoDB Source]]></category>
		<category><![CDATA[ssis tasks]]></category>
		<category><![CDATA[upsert]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=374</guid>

					<description><![CDATA[<p>Introduction MongoDB is one of the most poplar NoSQL database out there. In this article you will learn how to use ZappySys MongoDB Destination Connector to perform various bulk operations on MongoDB such as Insert, Update, Delete and Upsert. If you wish to learn how to Update MongoDB Array items then check this blog post instread. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/">SSIS &#8211; Loading data into MongoDB (Upsert, Delete, Update)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><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" />MongoDB is one of the most poplar <strong>NoSQL database</strong> out there. In this article you will learn how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/">ZappySys MongoDB Destination Connector</a> to perform various bulk operations on MongoDB such as Insert, Update, Delete and Upsert. If you wish to learn <a href="//zappysys.com/blog/update-mongodb-array-items-using-ssis/" target="_blank" rel="noopener">how to Update MongoDB Array items then check this blog post instread</a>.</p>
<p>&nbsp;</p>
<h2>MongoDB data read/write Example SSIS Package</h2>
<p>Before we talk more about loading data into MongoDB lets look at screenshot and steps involved in our sample package for this tutorial. Below sample SSIS package uses 4 <strong>Custom SSIS Tasks</strong></p>
<ol>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/">SSIS MongoDB Source Connector</a> (Used to read data from MongoDB Collection)</li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/">SSIS MongoDB Destination Connector</a> (Used to write data into MongoDB Collection also you can do other bulk operations such as MongoDB update, MongoDB upsert and MongoDB delete)</li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/">SSIS MongoDB ExecuteSQL Task</a> (Used to call any MongoDB Shell commands including MongoDB DDL or DML type operations such as CREATE/DROP, Insert, Update, Delete, Read, you can also call server side JavaScript)</li>
<li><a href="//zappysys.com/products/ssis-powerpack/dummy-data-source-free/">Dummy Data Source</a> (Used to generate sample JSON Documents which can be loaded in MongoDB)</li>
</ol>
<h2>MongoDB Examples</h2>
<p>Here is the list of various MongoDB examples included in attached sample package (see at the end for download links)</p>
<ul>
<li>MongoDB example &#8211; How to <em>read data from MongoDB</em> collection using SQL query language</li>
<li>MongoDB example &#8211; How to <em>load raw JSON document</em> into MongoDB Collection (<strong>Bulk Insert with Reload</strong>)</li>
<li>MongoDB example &#8211; How to do <em>MongoDB Upsert</em> (<strong>Bulk Update</strong> or Insert) for specific fields or entire document</li>
<li>MongoDB example &#8211; How to perform MongoDB Delete ( <strong>Bulk Delete</strong> based on Matching Rows)</li>
<li>MongoDB example &#8211; How to <strong>create new MongoDB collection</strong> (Only if not exist &#8211; Use safe option)</li>
<li>MongoDB example &#8211; How to fetch MongoDB collection <strong>record count</strong> and save to SSIS variable</li>
<li>MongoDB example &#8211; How to fetch MongoDB <strong>collection size</strong> and save to SSIS variable</li>
<li>MongoDB example &#8211; How to <strong>get collection names</strong> and loop through them using ForEach Loop Task</li>
<li>MongoDB example &#8211; How to <strong>save query output</strong> into Recordset variable and loop though records using ForEach Loop Task</li>
</ul>
<h2>Video Tutorial &#8211; Update/Delete/Write/Bulk Load data into MongoDB from SQL Server/ORACLE</h2>
<p>In below video tutorial you will see how easy it is to load data into MongoDB from any Datasource such as SQL Server, Oracle, MySQL, Flatfile etc. You will also learn how to product nested JSON from multiple tables using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a>. You can also use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> with Output as Document Mode to load raw JSON data.</p>
<div><a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/"><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>
<h2>Video Tutorial &#8211; Read data from MongoDB</h2>
<p>In the following video tutorial you will learn how to consume data from MongoDB Collection using <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/" target="_blank" rel="noopener">SSIS MongoDB Source Connector</a>. You will notice that it uses <strong>SQL query syntax</strong> rather than MongoDB specific native query syntax (JSON query). This makes it super easy to query data without any learning curve. Data stored in MongoDB is in JSON document format but Data coming out from <strong>MongoDB Source Connector</strong> is Flat table structure (It de-normalize nested nodes). You can also Query inner Hierarchy using <strong>JSON Path expression</strong> (e.g. query Orders from Customer Document using <strong>$.Customer.Orders[*]</strong> ) .</p>
<div><a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FksvCA8FxOzI%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></div>
<div id="attachment_388" style="width: 362px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-loading-data-into-mongodb-read-from-mongodb-upsert-delete-insert-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-388" class="size-full wp-image-388" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-loading-data-into-mongodb-read-from-mongodb-upsert-delete-insert-example.png" alt="SSIS Example - Loading data into MongoDB, Read from MongoDB, Upsert, Upsert, Delete Insert JSON Documents, Execute Shell Commands" width="352" height="482" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-loading-data-into-mongodb-read-from-mongodb-upsert-delete-insert-example.png 352w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-loading-data-into-mongodb-read-from-mongodb-upsert-delete-insert-example-219x300.png 219w" sizes="(max-width: 352px) 100vw, 352px" /></a><p id="caption-attachment-388" class="wp-caption-text">SSIS Example &#8211; Loading data into MongoDB, Read from MongoDB, Upsert, Upsert, Delete Insert JSON Documents, Execute Shell Commands</p></div>
<h2>MongoDB Insert &#8211; Bulk Loading data into MongoDB</h2>
<p>Using MongoDB Destination Connector you can easily Insert JSON documents in Bulk. There are two input modes for inserting records into MongoDB.</p>
<h3>Simple Mode &#8211; Loading data in simple mode (array not allowed)</h3>
<p>In simple loading mode you can map source columns to target column in MongoDB destination. If you Insert data using this mode then you cant load complex documents with array.</p>
<h3>Document Mode &#8211; Loading JSON documents into MongoDB</h3>
<p>In this mode you can insert/update/delete documents by mapping inbuilt __DOCUMENT__ input column which appears on mapping tab (Target columns). When you perform Insert you have two options (Insert (i.e. Append) and Reload (Truncate + Insert). When you select Operation=Reload in that case Collection is first Truncated and then new records are loaded.</p>
<p>In JSON document load mode if you don&#8217;t supply _id column part of your input JSON then new _id is automatically generated by MongoDB for newly inserted document.</p>
<div id="attachment_392" style="width: 589px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-load-json-documents-into-mongodb-collection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-392" class="size-full wp-image-392" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-load-json-documents-into-mongodb-collection.png" alt="Loading JSON Documents into MongoDB Collection (Map Raw Document Column)" width="579" height="669" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-load-json-documents-into-mongodb-collection.png 579w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-load-json-documents-into-mongodb-collection-260x300.png 260w" sizes="(max-width: 579px) 100vw, 579px" /></a><p id="caption-attachment-392" class="wp-caption-text">Loading JSON Documents into MongoDB Collection (Map Raw Document Column)</p></div>
<h3>Loading JSON files into MongoDB</h3>
<p>Another scenario could be loading JSON files into MongoDB. You can load JSON Files into MongoDB two ways.</p>
<ul>
<li>Use Flat File Source with just one column with DT_NTEXT datatype (use this method when you each JSON documents in one line and they are separated by new line as below screenshot)</li>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> with Output as Document option checked. You can map __DOCUMENT__ source column to Target MongoDB collection as below. Advantage of this method is you extract JSON from array too and specify many other advanced options.
<div id="attachment_393" style="width: 733px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-extract-raw-json-documents-from-json-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-393" class="size-full wp-image-393" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-extract-raw-json-documents-from-json-file.png" alt="SSIS Extract JSON Documents or Sub Documents from JSON file or JSON Array" width="723" height="605" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-extract-raw-json-documents-from-json-file.png 723w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-extract-raw-json-documents-from-json-file-300x251.png 300w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-393" class="wp-caption-text">SSIS Extract JSON Documents or Sub Documents from JSON file or JSON Array</p></div></li>
</ul>
<h2>Specifying LoadOptions</h2>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/">MongoDB Destination Connector</a> supports following <strong>LoadOptions</strong> property (see Component Properties Tab on UI) which controls how target data gets modified. <strong>LoadOptions</strong> property is ignored for <strong>Reload</strong> and <strong>Insert</strong> operations.</p>
<ul>
<li><strong>op</strong> : this option specify update operators (Valid for <strong>Update, Replace</strong> and <strong>Upsert</strong> operation (i.e. <strong>UpdateOrInsert</strong>) ).  See <a href="https://docs.mongodb.org/manual/reference/operator/update/" target="_blank" rel="noopener">this link</a> for more information on various Update operators available in MongoDB. Most common operators listed below. Refer official MongoDB <a href="https://docs.mongodb.org/manual/reference/operator/update/" target="_blank" rel="noopener">help</a> for more information.
<ul>
<li><strong>op=none</strong> : Replace entire document</li>
<li><strong>op=$set</strong>  : Update only those fields specified in mapping. If Specified mapping field not available in target then its added to target document.</li>
<li><strong>op=$push</strong> : Adds new item to destination array. See following examples (How to insert single or multiple documents into MongoDB Array by supplying JSON into  __DOCUMENT__ column<br />
<pre class="crayon-plain-tag">/* Insert single item into array - Construct input JSON as below */
{YourArrayField : 111 }

/* Insert multiple items into array - Construct document as below */
{YourArrayField : { $each: [ 111, 222, 333 ] } }

/* Insert multiple documents into array */
{YourArrayField : { $each: [ {OrderID:1, Total:20.00}, {OrderID:2, Total:12.00} ] } }</pre>
</li>
</ul>
</li>
<li><strong>multi</strong> : This option controls if you want to Update or Delete multiple records for matching condition for each upstream input record.  For example if you joining by Country and City columns for update and target system finds 5 records then by default they all will be updated if <strong>multi=true</strong> is set in <strong>LoadOptions</strong> property. If you don&#8217;t want to update multiple records</li>
</ul>
<h2>MongoDB Update</h2>
<p>MongoDB Destination Connector supports Batch Update and Batch Upsert Operations. There are few things to remember how Update operation works with MongoDB Destination Connector.</p>
<ul>
<li>To perform Update operation you have to specify Join Criteria for record lookup on target (see <strong>ColumnsForLookup</strong> property).</li>
<li>Specify JOIN columns in <strong>ColumnsForLookup</strong> property. Use comma to specify multiple columns (e.g. CustomerID,OrderID). If you dont specify columns in this property then any columns mapped other than __DOCUMENT__ will be considered as JOIN column.</li>
<li>With MongoDB destination you can only specify simple Update condition by mapping JOIN input columns. Behind the scene it will construct search query for update. For example if you Map 3 input columns (__DOCUMENT__ , Country, State) and you specify <strong>LoadOptions :</strong> <strong>op=$set;multi=true</strong> then its similar as below SQL Statement.<br />
<pre class="crayon-plain-tag">UPDATE MyCollection
SET [properties specified in __DOCUMENT__]
WHERE Country=[input value] AND State=[input value]</pre>
</li>
<li>Join columns can be individually mapped or can be supplied as part of JSON document mapped to __DOCUMENT__ column.</li>
<li>If __DOCUMENT__ column is not mapped then you must specify at least one column name in ColumnsForLookup property to identify search column.</li>
<li>If __DOCUMENT__ column is mapped and column name is not specified in <strong>ColumnsForLookup</strong> property then you must map at least one more input column which can treated as JOIN column</li>
</ul>
<h2>Update specific fields  ($set operator)</h2>
<p>To update specific fields in target MongoDB collection you can map JOIN column(s) and then map fields you want to update or map __DOCUMENT__ if you suppling JSON document with fields you want to update.</p>
<p>See below screenshot where its updating Customers record with new coordinates  based on City and Country information.</p>
<div id="attachment_397" style="width: 758px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-update-json-document-specified-fields-set-operator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-397" class="size-full wp-image-397" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-update-json-document-specified-fields-set-operator.png" alt="SSIS MongoDB Update Bulk - $set update operator - Update specific fields - Update single or multiple documents" width="748" height="527" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-update-json-document-specified-fields-set-operator.png 748w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-update-json-document-specified-fields-set-operator-300x211.png 300w" sizes="(max-width: 748px) 100vw, 748px" /></a><p id="caption-attachment-397" class="wp-caption-text">SSIS MongoDB Update Bulk &#8211; $set update operator &#8211; Update specific fields &#8211; Update single or multiple documents</p></div>
<h3>Update single or multiple target records for single input row</h3>
<p>If you want to update all matching records in target then set <strong>LoadOptions</strong> property to <strong>op=$set,multi=true</strong><br />
If you want to update only one record per matching criteria in target then set <strong>LoadOptions</strong> property to <strong>op=$set,multi=false</strong></p>
<h3>Update entire document (i.e. Overwrite/Replace documents)</h3>
<p>If you like to replace entire target document then you can do two ways. Few things you have to change for MongoDB Destination.</p>
<p><strong>Approach#1 </strong></p>
<ol>
<li>Select <strong>Operation</strong>=Replace (Rather than Update or Upsert)</li>
<li>Specify Join column in <strong>ColumnsForLookup</strong></li>
<li>On the mapping tab Map __DOCUMENT__ (Assuming you have Raw JSON coming from Upstream)</li>
</ol>
<p><strong>Approach#2</strong></p>
<p>Another approach is use $set operator in LoadOptions property then it will only update specified fields in mappings. But if you want to overwrite entire document (Replace document) then set <strong>LoadOptions</strong> property to <strong>op=none,multi=true</strong> or <strong>op=none,multi=false</strong> (If you want to update one record for matching condition)</p>
<h3>Insert single item into MongoDB Array using $push operator</h3>
<p>If you want to insert new items into array then set <strong>LoadOptions</strong> property to <strong>op=$push,multi=true</strong> or <strong>op=$push,multi=false</strong> (If you want to update one record for matching condition). You have to map __DOCUMENT__ column on target mappings tab to supply item(s) or document(s) you want to insert into target array.</p><pre class="crayon-plain-tag">/* Insert single number or string into MongoDB array - Construct input JSON as below */
{YourArrayField : 111 }

/* Insert single document into MongoDB array - Construct input JSON as below */
{YourArrayField : {OrderID:1, Total:20.00} }</pre><p>
<h3>Insert multiple items into MongoDB Array using $push operator along with $each</h3>
<p>Inserting multiple items into array requires use of <strong>$each</strong> modifier as below. Use above instructions except input document (e.g. data passed to __DOCUMENT__ column) will look like below (see how $each used).</p><pre class="crayon-plain-tag">/* Insert multiple items into MongoDB array - Construct document as below */
{YourArrayField : { $each: [ 111, 222, 333 ] } }

/* Insert multiple documents into MongoDB array */
{YourArrayField : { $each: [ {OrderID:1, Total:20.00}, {OrderID:2, Total:12.00} ] } }</pre><p>
<h3>Other MongoDB Update Operators</h3>
<p>So far we have seen <strong>$set</strong> and <strong>$push</strong> update operators. To learn more about other operators see <a href="https://docs.mongodb.org/manual/reference/operator/update/" target="_blank" rel="noopener">this link</a></p>
<h2>MongoDB Update Array Items ($pull, $push, $addToSet)</h2>
<p>If you wish to update items found inside nested array of document then <a href="//zappysys.com/blog/update-mongodb-array-items-using-ssis/" target="_blank" rel="noopener">Check this full length article</a></p>
<h2>MongoDB Upsert &#8211; Bulk Update or Insert JSON documents</h2>
<p>If you wish to perform Bulk Upsert using MongoDB Destination connector then select Upsert Action from dropdown (Action=UpdateOrInsert). In Upset if document is not found for matching criteria then new document is inserted in MongoDB Collection. If document is found then Update operation occurs. To set specific fields use <strong>op=$set</strong> in LoadOptions   and if you wish to overwrite entire document then use <strong>$op=none</strong> in <strong>LoadOptions </strong></p>
<div id="attachment_400" style="width: 488px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-upsert-json-document-update-or-insert-bulk.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-400" class="size-full wp-image-400" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-upsert-json-document-update-or-insert-bulk.png" alt="SSIS MongoDB Upsert - Bulk Update or Insert JSON documents" width="478" height="605" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-upsert-json-document-update-or-insert-bulk.png 478w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-mongodb-upsert-json-document-update-or-insert-bulk-237x300.png 237w" sizes="(max-width: 478px) 100vw, 478px" /></a><p id="caption-attachment-400" class="wp-caption-text">SSIS MongoDB Upsert &#8211; Bulk Update or Insert JSON documents</p></div>
<h2>MongoDB Delete &#8211; Bulk delete MongoDB JSON documents</h2>
<p>To delete documents from collection you can set operation=Delete on Component properties page. For delete you can simply map _id column on target or just supply columns based on you want to search records you want to delete.</p>
<p>To delete maximum one record for each input row set <strong>LoadOptions</strong> property to <strong>op=none,multi=false</strong> or set <strong>op=none,multi=false</strong> if you want to delete more than one record for matching condition.</p>
<h2>MongoDB Collection Reload &#8211; Remove All (Truncate collection)</h2>
<p>To reload collection set operation to Reload on Component properties page. <strong>Reload</strong> operation first clears target collection and perform <strong>bulk Insert</strong> operation</p>
<h2>Generate JSON for MongoDB data load</h2>
<p>Now lets talk about different ways to produce simple or complex JSON using ZappySys components.  There are 3 ways you can produce JSON which can be loaded into MongoDB Collection. Following section will describe each approach and you can select which one best suited for you.</p>
<h3>Generate JSON &#8211; Using Export JSON Task</h3>
<p>Export JSON Task can export JSON to File or variable which you can consume via <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> (Check Output as Document option) and supply to MongoDB Destination Connector (map to __DOCUMEN__).</p>
<p>Check this link for more info :  <a href="//zappysys.com/blog/export-json-from-sql-server-using-ssis/" target="_blank" rel="noopener">Export Json from sql server using ssis</a></p>
<h3>Generate JSON &#8211; Using JSON Generator Transform</h3>
<p>JSON generator transform is useful when you want to Produce JSON inside pipeline from single or multiple input.</p>
<p>Check this link for more info :  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON generator Transform (Watch Video on this page)</a></p>
<div style="width: 600px" class="wp-caption alignnone"><img decoding="async" title="JSON Generator Transform - Generate JSON and Load into MongoDB" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-load-documents-mongodb.png" alt="JSON Generator Transform - Test JSON Path Settings" width="590" /><p class="wp-caption-text">JSON Generator Transform &#8211; Generate JSON documents and load into MongoDB</p></div>
<h3>Generate JSON &#8211; Using Dummy Data Source (Fake JSON for Testing)</h3>
<p>If you need to produce JSON for testing purpose then use <a href="//zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">Dummy Data Source</a> (Select JsonDocuments Template from dropdown and click ok)</p>
<h2>Query/Read data from MongoDB</h2>
<p>Visit following links to learn more about reading data from MongoDB.</p>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/">SSIS MongoDB Source Homepage</a><br />
<a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/mongodb-source.htm#A_QueryLanguage">MongoDB SQL Query Reference</a><br />
<a href="//zappysys.com/blog/read-mongodb-data-from-array-extract-nested-sub-documents/">MongoDB data extract &#8211; from nested sub documents and array</a></p>
<h2>Execute MongoDB Shell commands in SSIS (e.g. Create/Drop collection)</h2>
<p>MongoDB SOurce and Destination Connectors are great for read/write data. But what if you want to issue ad-hoc MongoDB shell command such as create collection/drop collection ? No worry.. <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack v2.0</a> released new Task called <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/">SSIS MongoDB ExecuteSQL Task</a> This task comes with many examples listed on the UI itself (Look for Examples dropdown menu on UI). You can use <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/">SSIS MongoDB ExecuteSQL Task</a> to perform many operations such as</p>
<ul>
<li>Create/Drop MongoDB collections</li>
<li>Get collection list as ADO.net recordset so you can loop through using ForEachLoop task</li>
<li>Call serverside JavaScript</li>
<li>Fetch data as ADO.net recordset and store in SSIS variable so you can loop using ForEachLoop task</li>
<li>Drop database</li>
<li>Call many shell commands</li>
</ul>
<h2>Download MongoDB Example Files used in this tutorial</h2>
<p>To test this package you first need to <a href="//zappysys.com/products/ssis-powerpack/">download SSIS PowerPack</a><br />
Once SSIS PowerPack installed you can download following SSIS sample project file(s).</p>
<p><a title="MongoDB Examples - Loading data into MongoDB - SSIS 2008" href="//zappysys.com/downloads/files/ssis/MongoDB_Load_Demo_2008.zip">Download sample files &#8211; SSIS 2008</a><br />
<a title="MongoDB Examples - Loading data into MongoDB - SSIS 2012" href="//zappysys.com/downloads/files/ssis/MongoDB_Load_Demo_2012.zip">Download sample files &#8211; SSIS 2012</a><br />
<a title="MongoDB Examples - Loading data into MongoDB - SSIS 2014" href="//zappysys.com/downloads/files/ssis/MongoDB_Load_Demo_2014.zip">Download sample files &#8211; SSIS 2014</a><br />
<a title="MongoDB Examples - Loading data into MongoDB - SSIS 2016" href="//zappysys.com/downloads/files/ssis/MongoDB_Load_Demo_2016.zip">Download sample files &#8211; SSIS 2016</a></p>
<h2>Conclusion</h2>
<p>MongoDB makes it super easy to store <strong>JSON documents</strong> and gives you whole new way of manipulating documents with ease of use. ZappySys SSIS Connectors and Tasks for MongoDB makes it possible to implement various data integration scenarios with MongoDB. <a href="//zappysys.com/products/ssis-powerpack/">Click here to Download SSIS PowerPack</a> and try it your self.</p>
<p><b>Keywords:</b><br />
<em>Loading data into MongoDB</em> | <em>mongodb upsert array</em> | <em>mongodb upsert example</em> | <em>mongodb insert or update</em> | <em>mongo insert or update</em> | <em>mongo upsert</em> | <em>mongo insert JSON</em> | <em>mongo upsert JSON | update data into MongoDB</em></p>
<p>The post <a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/">SSIS &#8211; Loading data into MongoDB (Upsert, Delete, Update)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
