Snowflake - Table List

On this Page

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.

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:

A / \ B C \ / D

 

The Table List will output the following documents: 

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:

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



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:

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.

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

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

  • Asterisk (*): Indicates a mandatory field.

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

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

  • Add icon (): Indicates that you can add fields in the field set.

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

Field Name

Field Type

Description

Label*

 

Default Value: Snowflake - 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. 

 



Snap Execution

 

Default Value: Validate & Execute
Example: Execute only



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.

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:

Snap Pack History