SQL Server - Table List
In this article
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.
This Snap supports SQL Server 2008 or newer.
name -  The fully-qualified name of the table. To use the table name in another Snap, like a Select or Insert, you can pass it through a ForEach Snap to another pipeline with the Select or Insert.
type - The type of table. This value is currently fixed to the string "TABLE".
dependents - (If Compute table graph is selected) A list of table names that have references to this table, including this table.
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
SQL Server - Table List Snap is a Read-type Snap that lists the tables in a database
Prerequisites
None.
Support for Ultra Pipelines
Works in Ultra pipelines.
Limitations & Known Issues
None.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| This Snap has at most one input views. |
Output | Document |
|
| This Snap has at most one output view. |
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:
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:Â SQL Server - Table List | 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 | String/Expression | Specify the database schema name. Selecting a schema filters the Table name list to show only those tables within the selected schema. The property is suggestible and will retrieve available database schemas during suggest values. |
Compute table graph  Default Value: Deselected | Checkbox | Specify 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. Note that as turning on this option will significantly slow down the Snap, it should be left as off unless you need it. |
Number of retries  Default Value: 0 | 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 | 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 Value: Validate & Execute | Dropdown list | Select one of the following three modes in which the Snap executes:
|
Examples
In the following example, the Table List Snap retrieves all the tables under schema 'dbo' and writes it to output view.Â
Â
The sample output view data is shown below:
Snap Pack History
Related Content
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.