Skip to end of banner
Go to start of banner

AlloyDB Insert

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

In this article

Overview

You can use this Snap to execute a SQL Insert statement using the document's keys as the columns to insert to and the document's values as the values to insert into the columns.

Snap Type

AlloyDB Insert Snap is a Write-type Snap.

Prerequisites

A valid account with the required permissions.

Support for Ultra Pipelines  

Works in Ultra Pipelines if batching is disabled.

Limitations and Known Issues

None.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

Binary

  • Min: 0

  • Max: 1

  • Mapper

  • AlloyDB Execute

 A table name and record details. By default the input view accepts the rows to insert into the table. A second input view can be added that accepts the table metadata document from a database Select Snap.  The table metadata is used to create the target table in the database.

Output

Document

Binary

  • Min: 0

  • Max: 1

  • Filter

  • JSON Formatter

Inserts a record.

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:

  • Stop Pipeline Execution: Stops the current pipeline execution if the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the remaining records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk ( * ): Indicates a mandatory field.

  • Suggestion icon ((blue star)): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ((blue star) ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ( (blue star) ): Indicates that you can add fields in the fieldset.

  • Remove icon ( (blue star)): Indicates that you can remove fields from the fieldset.

  • Upload icon ((blue star) ): Indicates that you can upload files.

Field Name

Field Type

Description

Label*

Default Value: AlloyDB Insert
ExampleAlloyDB Insert

String

Specify a unique name for the Snap.

Schema

Default Value: N/A
Example: SYS

String/Expression

Specify the database schema name. Selecting a schema filters the Table name list to show only those tables within the selected schema.

You can pass values using the Pipeline parameters but not thorugh the upstream Snap.

Table name*


Default Value: N/A
Example: users 

String/Expression

Specify the table that the rows will be inserted into.

You must check the datatype of each column in the table into which you want to insert the input data, and structure your data accordingly; else the endpoint generates an error. For example, if the column contact_id expects data in the UUID datatype, you must provide UUID data. For details on the UUID datatype, see The Basics of PostgreSQL UUID Data Type.

Create table if not present


Default Value: Deselected 

Checkbox

Select this checkbox to automatically create the target table if it does not exist.

  • If a second input view is configured for the Snap and it contains a document with schema (metadata) of the source table, the Snap creates the new (target) table using the same schema (metadata). However, if the schema comes from a different database, the Snap might fail with Unable to create table: "<table_name>" error due to data type incompatibility.

  • In the absence of a second input view (the schema/metadata document), the Snap creates a table based on the data types of the columns generated from the first row of the input document (first input view).

Preserve case sensitivity


Default Value: Deselected

Checkbox

Select this checkbox to preserve the case sensitivity of the column names while performing the insert operation.

If you do not select this option, then Snap converts the column names in the input document to match the column names in the target database table before inserting the values. The Snap checks for the following three conditions:

  • If the column name in the table is in lower case, it modifies the column label to lower case.

  • If the column name in the table is in the upper case, it modifies the column label to upper case.

  • If the conditions mentioned above are not met, it takes the column label as is.

On the contrary, if you select this checkbox, the Snap does not convert the case of the column names and inserts the names as-is in the target database. Therefore, ensure that the column labels in the input document match the column labels in the target database table. Else, the Snap does not insert the values and displays an error. For example, if the column names (ID, Name) in the input document do not match the column names (Id, name) in the database, then the Snap does not insert the values and displays an error.

Number of retries


Default value: 0
Example3

Integer/Expression

Specify the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response.

Retry interval (seconds)


Default value: 1
Example: 10

Integer/Expression

Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception. 

Snap Execution

Default ValueExecute only
Example: Validate & Execute

Dropdown list

Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

In a scenario where the Auto commit on the account is set to true, and the downstream Snap does depends on the data processed on an upstream Database Bulk Load Snap, use the Script Snap to add delay for the data to be available. For example, when performing a create, insert and a delete function sequentially on a pipeline, using a Script Snap helps in creating a delay between the insert and delete function or otherwise it may turn out that the delete function is triggered even before inserting the records on the table.

Downloads

  1. Download and import the Pipeline into SnapLogic.

  2. Configure Snap accounts, as applicable.

  3. Provide Pipeline parameters, as applicable.

  File Modified
You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.
No files shared here yet.
  • Drag and drop to upload or browse for files
  • Snap Pack History

    Release

    Snap Pack Version

    Date

    Type

    Updates

    May 2024

    main26341

    Stable

    Updated the Delete Condition (Truncates a Table if empty) field in the AlloyDB Delete Snap to Delete condition (deletes all records from a table if left blank) to indicate that all entries will be deleted from the table when this field is blank, but no truncate operation is performed.

    February 2024

    main25112

    Stable

    Updated and certified against the current SnapLogic Platform release.

    November 2023

    main23721

    Stable

    Updated and certified against the current SnapLogic Platform release.

    August 2023

    main22460

    Stable

    The AlloyDB Execute Snap now includes a new Query type field. When Auto is selected, the Snap tries to determine the query type automatically.

    May 2023

    main21015

    Stable

    Upgraded with the latest SnapLogic Platform release.

    February 2023

    main19844

    Stable

    Upgraded with the latest SnapLogic Platform release.

    November 2022

    main18944

    Stable

    The AlloyDB Insert Snap now creates the target table only from the table metadata of the second input view when the following conditions are met:

    • The Create table if not present checkbox is selected.

    • The target table does not exist.

    • The table metadata is provided in the second input view.

    September 2022

    430patches18149

    Latest

    The AlloyDB Select and AlloyDB Execute Snaps now read NaN values in Numeric columns.

    4.30Patches

    430patches17841

    Latest

    Introduced the Google AlloyDB Snap Pack— a fully managed PostgresSQL-compatible database service that you can use for all your database workloads. This Snap Pack offers the following Snaps:


    • No labels