Azure SQL - Bulk Load

In this article

 

Overview

You can use this Snap to perform a bulk load operation from the input view document stream to the target table by using SQLServerBulkCopy API. It uses a memory buffer to send records to the target table instead of a temporary CSV file. The Batch size and Bulk copy timeout values can be used to tune the performance and memory used.

This Snap supports a dot (.) as a separator for milliseconds in date and time formats, which helps in handling date and time data types and functions when working with SQL Server (Transact-SQL). Learn more: Date and Time Data Types and Functions - SQL Server (Transact-SQL)

azure-sql-bulk-load-overview.png

 

Snap Type

The Azure SQL Bulk Load Snap is a Write-type Snap that performs a bulk load operation.

Prerequisites

The Azure SQL database account requires the SQL Server JDBC driver. Version 4.1 and older do not support the SQLServerBulkCopy API.

Support for Ultra Pipelines

Does not support Ultra Pipelines

Limitation

  • Microsoft does not support the DateTime data type when writing to Azure Data Warehouse. As a workaround, change the data type from DateTime to varchar when writing to Azure Data Warehouse. Note that if the table does not exist in the database, enabling the Create table if not present property automatically converts all DateTime fields to varchar fields. For more information on this known issue, see Known Limitations for the batch insert operation

  • You cannot modify certain columns in Azure SQL because they might either be computed columns or the result of a UNION operator, such as "InventoryValue."

  • The Azure Bulk Load Snap supports the money and smallmoney data types only within the following specific ranges:

Data Type

Range

Data Type

Range

money

-922,337,203,685,477.5808 to 922,337,203,685,477.5807

smallmoney

-214,748.3648 to 214,748.3647

When you insert a value beyond the specific range, the Snap does not fail but inserts incorrect values. For instance, see the table below for the incorrect inserted values against the specific value:

Data Type

 When you update

Bulk Load is updated to

smallmoney

-214758.3648

-214738.3649

money

922337203685487.5808

922337203685467.5808



smallmoney

214758.3647

214738.3648

money

922337203685487.5807

-922337203685467.5809

This issue is caused by MSSQL-JDBC dependency from Microsoft®, that converts small-money/money values to int/long values. SnapLogic® has reported a bug in Microsoft®MSSQL-JDBC GitHub repository. You can track the issue here.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

 

  • Min: 0

  • Max: 2

Mapper

  • All input documents must contain map data with a key-value pair. All keys must be spelled the same as in columns in the target table (case-sensitive). Input documents must not contain any data other than data to be bulk-loaded.

  • All input documents must have the same keys. If the number of keys is smaller than the number of columns in the target table, the Snap fills missing keys with null values. If key names in the input document is different from column names, Mapper Snap can be used to map key names to column names.

Output

Document

  • Min: 0

  • Max: 1

JSON Formatter

  • The input document stream is converted to multiple batches, which are bulk-loaded to the target table by using SQLServerBulkCopy API. The Snap converts the input data values according to the corresponding SQL Server column data types to Java class objects which SQLServerBulkCopy accepts.

  • Outputs the bulk-load result in a key-value pair, for example: