Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Snap type:

Write

Description:

This Snap reads binary data passed as binary objects from its input view and creates a .zip file at a specified file destination. 
Note: Currently, this Snap supports only the .zip format.

  • Expected upstream Snaps: Any Snap that produces binary data in the output view, such as File Reader, or Unzip.
  • Expected downstream Snaps: Downstream Snap is optional. Any Snap with a document input view can be connected downstream.
  • Expected input: Any binary data stream to be zipped
  • Expected output: The output view for this Snap is optional. If an output view is open and the zip file write action is successful, the output view provides a document with information on the filename, result, and original data. An example is:
Code Block
{
        "filename": "ftp://ftp.Snaplogic.com/home/qatest/sample.zip",
        "result": "overwritten"
}

The value of the "result" field can be "overwritten" or "created" or "ignored". The value "ignored" indicate that the Snap did not overwrite the existing file because the value of the File action property is "IGNORE".

Prerequisites:

Multiexcerpt include macro
nameEC2Prerequisite
pageFile Reader

Support and limitations:Does not work in in Ultra Pipelines.
Known Issues:This Snap does not create an output file when using the input from SAS Generator Snap configured with only the DELETE SAS permission. This is not the case when the target file exists.
Account: 

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. This Snap supports a Basic auth account, an AWS S3 auth account, SSH Auth account, SMB account, or no account. See Configuring Binary Accounts for information on setting up accounts that work with this Snap.

Account types supported by each protocol are as follows:

ProtocolAccount types
sldbno account
s3AWS S3
ftpBasic Auth
sftpBasic Auth, SSH Auth 
ftpsBasic Auth
hdfsno account
httpno account
httpsno account
smbSMB
wasb

Azure Storage

wasbsAzure Storage
gs

Google Storage


Note

The FTPS file protocol works only in explicit mode. The implicit mode is not supported.

Required settings for account types are as follows: 

Account TypeSettings
Basic AuthUsername, Password
AWS S3Access-key ID, Secret key
SSH AuthUsername, Private key, Key Passphrase
SMBDomain, Username, Password
Azure StorageAccount name, Primary access key
Google StorageApproval prompt, Application scope, Auto-refresh token
(Read-only properties are Access token, Refresh token, Access token expiration, OAuth2 Endpoint, OAuth2 token and Access type.)


Views:


InputThis Snap has at least one binary input view from which it gets the binary data to be written to the zip file specified in the File name property.
OutputThis Snap has at most one document output view.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.


Settings

Label 

Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

File name


Required. Specifies the URL of the file where the output binary data is written. The supported file protocols are:

  • sldb:
  • http:
  • sftp:
  • ftp:
  • ftps:
  • s3:
  • hdfs:
  • webdhfs:
  • smb:
  • wasb:
  • wasbs:
  • gs:


This property works similar to the File name property of the File Writer Snap. Please refer the Settings section of the File Writer Snap for additional information.

When using expressions to build a file name, ensure that the resulting file name does not contain characters that are not supported by the target platform. For example, a file name that contains the special character ":" is not supported in SMB.

Note
  • Ensure the file name does not contain '?' character because it is not supported. The Snap fails with an error if you include the '?' character.
  • When the Snap zips multiple binary data and when the File name property is an expression (such as $Filename), all file name values in the headers of the binary data should be the same. Otherwise, the Snap will throw an exception.

Multiexcerpt include macro
nameAcceptable File Paths
pageFile Writer

Multiexcerpt include macro
nameLint Warning
pageFile Writer

File action


Required. The action to perform if the file already exists. The options available include:

  • Overwrite: If Overwrite is selected, the Snap attempts to write the file without checking for the file's existence for  better performance and the "fileAction" field will be "overwritten" in the output view data.
  • Ignore: The Snap does not overwrite the existing file and will do nothing but write the status and file name to its output view.
  • Error:  If Error is selected, the error displays in the Pipeline Run Log. If an error view is defined, the error will be written there as well.
Info
titleWrite files to Azure Blob Storage along with Content Type

You can prevent the Snap from writing files always to Azure Blob Storage (WASB: or WASBS: file protocol) with the application/octet-stream content-type. To do so, configure a binary header property in an upstream Snap, such as JSON Formatter or Mapper, to match the file contents – application/zipapplication/java-archive and so on; and pass it as the $content-type (case-sensitive) for the file.

Binary header property in upstream Snap


Note
For wasb:// and wasbs:// file protocols, only the Overwrite file action is supported.

Default valueOverwrite


Base directory


The root directory for all the files added to .zip file.


Use input view label


If true, the input view label is used for all names of the files added to the zip file. Otherwise, the input view ID is used instead, when input binary stream does not have its content-location in its header. When this option is selected, if there are more than one binary input streams in an input view, for the second input stream and after, the file names will be the input view label appended with '_n'. If the label is in the format of 'name.ext', '_n' will be append to the 'name', e.g. name_2.ext for the second input stream.

Example:   If this option is selected,  if Base directory is testFolder and the input view label is test.csv, the file name for the first binary input stream in that input view will be testFolder/test.csv, and the second, testFolder/test_2.csv, and the third, testFolder/test_3.csv, and so on.

Default value: Not selected

Number of retries

Specifies the maximum number of retry attempts when the Snap fails to write. If the value is larger than 0, the Snap first stores the input data in a temporary zip file before writing to the target file.

Info

Ensure that the local drive has sufficient free disk space as large as the expected target file size.

Example:  3

Minimum value: 0

Default value: 0

Multiexcerpt include macro
nameretries
pageFile Reader

Retry interval (seconds)

Specifies the minimum number of seconds for which the Snap must wait before attempting recovery from a network failure.

Example:  3

Minimum value: 1

Default value: 1

AWS Canned ACL

The predefined ACL grants (from AWS) to use when writing a file to S3. Choose a Canned ACL from the available options:

  • None
  • Private
  • PublicRead
  • PublicReadWrite
  • AuthenticatedRead
  • LogDeliveryWrite
  • BucketOwnerRead
  • BucketOwnerFullControl
  • AwsExecRead

Watch the video for more information about AWS Canned ACL.

Learn more about AWS Canned ACLs.

Default Value: None
Example: PublicRead

Note

This field appears only when your account type is set to AWS S3.


Advanced properties

Use this field set to configure advanced properties if any. The field set contains the following fields:

  • Properties
    • SAS URI
  • Values
Properties

The Properties list contains SAS URI option.

Multiexcerpt include macro
nameSASURI_Description
pageFile Reader

Note

If the SAS URI value is provided in the Snap settings, then the settings provided in the account (if any account is attached) are ignored.


ValuesProvide a value for the SAS URI.

Multiexcerpt include macro
nameSnap Execution
pageSOAP Execute

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read



Insert excerpt
Binary Snap Pack
Binary Snap Pack
nopaneltrue