Versions Compared

Key

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

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

You can use this Snap to output a list of tables in a database. The Snap will connect to the database, read its metadata, and output a document for each table found in the database. The table names are output in a topological order so that tables with the fewest dependencies are output first. In other words, if table A has a foreign key reference to table B, then table B will be output before A. The ordering is intended to ease the process of replicating a group of tables from one database to another.

Image RemovedImage Added

Replicating a Subset of Tables

The output of the Table List Snap can be directly used to replicate an entire database.  However, if you are only interested in a subset of tables, you can use a Filter Snap to select the table names you are interested in as well as the tables that they reference. For example, given the following diamond-shaped table graph where A depends on B and C and they both depend on D:

Code Block
       A
      / \
     B   C
      \ /
       D 

The Table List will output the following documents: 

Code Block
name=D; dependents=[A, B, C, D]
name=C; dependents=[A, C]
name=B; dependents=[A, B]
name=A; dependents=[A]

So, if you wanted to copy just table 'A' and its dependencies, you can add a Filter Snap with the following expression:

Code Block
 $.dependents.indexOf('A') != -1

The filter will then remove any extra tables that happen to be in the schema.

Snap Type

The Snowflake - Table list Snap is a Read-type Snap. 

Prerequisites

Insert excerpt
Snowflake - Bulk Load
Snowflake - Bulk Load
nopaneltrue


Security Prerequisites

You should have the following permissions in your Snowflake account to execute this Snap: 

  • Usage (DB and Schema): Privilege to use database, role, and schema.

The following commands enable minimum privileges in the Snowflake Console:

Code Block
grant usage on database <database_name> to role <role_name>;
grant usage on schema <database_name>.<schema_name>;

For more information on Snowflake privileges, refer to Access Control Privileges.

Internal SQL Commands

This Snap uses the Show Tables command internally. It enables you to list tables for the current or specified database or schema, or across your entire account.

Info

The Tables are retrieved from the Account Metadata. See Snowflake Accounts for more information. 

Support for Ultra Pipelines

Works in Ultra Pipelines. However, we recommend that you not use this Snap in an Ultra Pipeline.

Known Issues

Because of performance issues, all Snowflake Snaps now ignore the Cancel queued queries when pipeline is stopped or if it fails option for Manage Queued Queries, even when selected. Snaps behave as though the default Continue to execute queued queries when the Pipeline is stopped or if it fails option were selected.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Input

Document

  • Min: 0

  • Max: 1

  • Mapper

  • Copy

Output

Document

  • Min: 1

  • Max: 1

  • JSON Formatter

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 when 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

Info
  • 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 whether 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 field set.

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

Field Name

Field Type

Description

Label*

Default ValueSnowflake - Table List
Example: Load Employee Tables

String

Specify 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.

Schema name


Default Value: N/A
Example: schema_demo


String/Expression

Specify the database schema name. In case it is not defined, then the suggestion for the table name will retrieve all tables names of all schemas. The property is suggestible and will retrieve available database schemas during suggest values.

A Schema name with special characters is not supported.

Compute table graph

Default value: Deselcted

Checkbox

Computes the dependents among tables and returns each table with a list of tables it has foreign key references to. The ordering of outputted tables is from least dependent to most dependent. 

Turning on this option will significantly slow down the Snap; it should be left as off unless needed.


Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

Default Value: Validate & Execute
Example: Execute only


Dropdown list

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Example


In the following example, the Snowflake Table List Snap retrieves all the tables under schema 'PUBLIC' and writes it to the output view. 

Successful execution of the Snap gives the following output view:


Insert excerpt
Snowflake Snap Pack
Snowflake Snap Pack
nopaneltrue