Setting Up Data Ingestion for Your ServiceNow Data¶
This topic describes how to set up data ingestion for the Snowflake Connector for ServiceNow.
Note
The Snowflake Connector for ServiceNow ingests data from ServiceNow tables into Snowflake. Data ingestion
depends on v2
of the ServiceNow table API.
In this Topic:
Strategies for Ingesting ServiceNow Tables¶
Note
The connector can only ingest tables with
sys_id
columns present.ServiceNow views are not supported. Instead of ingesting these views, you should synchronize all tables for the underlying view and join the synchronized tables in Snowflake.
The connector uses different ingestion strategies, depending on the table schema. The connector uses three ingestion modes:
The initial load of data occurs for each table when the table is enabled for synchronization.
In this mode, the table is ingested by iterating through the records identified by the IDs in the
sys_id
column. Once all records are ingested, the initial load phase is completed.Incremental updates occur only for tables with
sys_updated_on
orsys_created_on
columns.Incremental updates begin after the initial load is done and occur on a regular schedule that you can configure. In this mode, the connector ingests only the records that were added, updated or deleted since last synchronization.
For tables that do not have
sys_updated_on
orsys_created_on
columns, the connector uses truncate and load mode.In this mode, the table is always ingested using the initial load approach, and newly ingested data replaces the old data. The connector replaces the data by running the
INSERT OVERWRITE
command.
Note
In the “incremental updates” mode, the connector uses the
sys_updated_on
column, if that column is present.If the column is not present, the connector uses the
sys_created_on
column instead.For rotated tables, the connector always uses the
sys_created_on
column. If the table is rotated using a different column thansys_created_on
, the ingestion of that table might cause performance issues.
Parallel Ingestion of ServiceNow Tables¶
The connector ingests a few tables in parallel, but the ingestion of each individual table is a synchronous process. This means that ingesting large tables might block the connector from updating other tables. This issue is more likely to occur during the initial load phase than in the other phases.
Note
If the
sys_updated_on
orsys_created_on
fields are not updated when the record is modified in ServiceNow, those modifications won’t be propagated to Snowflake, which results in data inconsistency. Snowflake recommends that you avoid disabling the update of system fields.If a record deletion is not audited, information about deleted records won’t be propagated to Snowflake, resulting in a data inconsistency.
Note
Due to restrictions on the Snowflake and ServiceNow REST APIs, the connector cannot ingest a table if a single row exceeds 10 MB of data. In that case, the connector tries to ingest data with the frequency defined in the table schedule. If a row exceeds the limit, the connector generates an error message and continues ingesting another table.
Setting Up Data Ingestion Using Snowsight¶
To set up data ingestion using Snowsight, do the following:
Sign in to Snowsight as a user with the ACCOUNTADMIN role.
In the left navigation, select Marketplace.
Search for the Snowflake Connector for ServiceNow, then select the tile for the connector.
In the page for the Snowflake Connector for ServiceNow, select Select Tables.
This displays a list of all the ServiceNow tables.
Note
The connector can only ingest tables with
sys_id
columns present.Select the tables you want to ingest:
Search for the table you want to ingest.
Select the checkbox in the Status column next to the table you want to select.
Under Synch Schedule, select how frequently you want to synchronize the table between Snowflake and ServiceNow.
Repeat these steps for each table you want to ingest into Snowflake.
Select the heading of the Status column to see the tables you have currently selected.
Select Start Ingestion to begin ingesting data into your Snowflake account.
The connector status changes to Loading Data. When at least one of the tables is ingested successfully, the connector status changes to Last Successful Load: just now.
Refer to Monitoring the Connector for information on how to view the contents of the tables in Snowflake.
Modifying Data Ingestion Using Snowsight¶
To modify the ServiceNow tables to be ingested or the synchronization schedule for the tables, do the following:
Sign in to Snowsight as a user with the ACCOUNTADMIN role.
In the left navigation, select Marketplace.
Search for the Snowflake Connector for ServiceNow, then select the tile for the connector.
In the page for the Snowflake Connector for ServiceNow, select Edit.
Modify the tables you want to ingest:
Search for the table you want to ingest.
Select the checkbox in the Status column next to the table you want to select or deselect.
Under Synch Schedule, select how frequently you want to synchronize the table between Snowflake and ServiceNow.
Select Update.
Setting Up Data Ingestion Using SQL Statements¶
To set up data ingestion using SQL Statements, do the following:
Note
To configure these settings, you use stored procedures that are defined in the PUBLIC schema of the database that serves as an instance of the connector.
Before calling these stored procedures, select that database as the database to use for the session.
For example, if that database is named my_connector_servicenow
, run the following command:
USE DATABASE my_connector_servicenow;
Specifying the Synchronization Schedule¶
The Snowflake Connector for ServiceNow synchronizes data from all ServiceNow tables to Snowflake on a specified schedule. By default, all of the tables are synchronized once every hour (1h).
To change the default synchronization schedule for all tables, call the CONFIGURE_CONNECTOR
stored procedure
with the following arguments:
CALL CONFIGURE_CONNECTOR('data_ingestion_schedule', '<schedule>');
Where:
data_ingestion_schedule
(the string literal)Specifies that you want to configure the schedule for synchronization.
schedule
Specifies the frequency of the synchronization. You can specify one of the following string values:
'30m'
'1h'
'3h'
'6h'
'12h'
'1d'
The connector also allows you to specify a different schedule for each table that is enabled for
synchronization. To change the synchronization schedule for a selected set of tables, call the
CONFIGURE_CONNECTOR_TABLES
stored procedure with the following arguments:
CALL CONFIGURE_CONNECTOR_TABLES('schedule_interval', '<schedule>', '<table_names>');
Where:
schedule
Specifies the frequency of the synchronization. You can specify one of the following string values:
'30m'
'1h'
'3h'
'6h'
'12h'
'1d'
table_names
Specifies a comma-delimited list of the table names.
For these tables, the schedule that you specify in the
schedule
parameter overrides the default schedule that you set by calling theCONFIGURE_CONNECTOR('data_ingestion_schedule', 'schedule')
stored procedure.
Enabling or Disabling the Synchronization of a Table¶
To enable or disable the synchronization of data for a specific table in ServiceNow, call the ENABLE_TABLES
stored procedure with the following arguments:
CALL ENABLE_TABLES('<tables_to_configure>', <enable>);
Where:
tables_to_configure
Specifies a comma-delimited list of ServiceNow table names.
Use the table name, not the label displayed in the ServiceNow UI. You can find the table name in the data dictionary tables in ServiceNow. In the ServiceNow UI, go to System Definition » Tables. The Name column displays the name of the table.
enable
Specifies whether or not synchronization should be enabled or disabled for these tables. Specify
TRUE
to enable orFALSE
to disable.
For example, to enable the synchronization of the tables named table1
, table2
, and table3
, run
the following command:
CALL ENABLE_TABLES('table1,table2,table3', TRUE);
To prevent these tables from being synchronized, run the following command:
CALL ENABLE_TABLES('table1,table2,table3', FALSE);
Disabling the table stops its synchronization. When the table synchronization is re-enabled, ingestion resumes from where it was paused.
Note
Disabling all tables from synchronization does not mean that the Snowflake Connector for ServiceNow will stop generating costs. Some tasks may run in the background, such as those related to notifications.
The ENABLE_TABLES
procedure adds the specified table names to the ENABLED_TABLES
view.
If you want to add all tables available in ServiceNow to the ENABLED_TABLES
view, call the
PREFILL_CONFIG_TABLE
stored procedure.
Note
In order for you to call this procedure, the ServiceNow user used by the connector must have access to the
sys_db_object
table.
To call this procedure, run the following command:
CALL PREFILL_CONFIG_TABLE();
This procedure adds all ServiceNow tables to the ENABLED_TABLES
view and disables the tables for ingestion by default.
To enable these newly added tables for synchronization:
Run the following commands to produce a comma-delimited list of the tables in
ENABLED_TABLES
view:SELECT LISTAGG(TABLE_NAME, ',') FROM ENABLED_TABLES;
In the list returned by this command, remove any tables that should not be synchronized.
Call the
ENABLE_TABLES
stored procedure, and pass in this list.
If new tables have been added recently to ServiceNow, you can identify the new tables and enable those tables for
synchronization by using this same approach (i.e. generating the list of tables, editing the list, and passing the
list to the ENABLE_TABLES
stored procedure).
Note
The connector does not support roll backs or delete recoveries in ServiceNow.
Using the roll back and delete recovery features may result in data inconsistency. Records that are recovered in ServiceNow may still be marked as deleted in Snowflake. To resolve it you can use the RELOAD_TABLE stored procedure.
Reloading Data in a Table¶
To reload data in particular table, call the RELOAD_TABLE
stored procedure:
CALL RELOAD_TABLE('<table_name>');
Where:
table_name
Specifies the name of the table to reload.
When you call the RELOAD_TABLE
stored procedure, the connector performs the following example:
The connector suspends the original table for ingestion temporarily.
Note
While the table is being reloaded, you cannot re-enable the table for ingestion.
The connector creates a separate temporary table for ingestion.
The connector ingests the data into this new temporary table. This table is visible in the CONNECTOR_STATS view as a table named with a
__tmp
suffix).After the data is ingested, the connector replaces the data in the original table with the data in the temporary table.
The connector deletes the temporary table.
The connector re-enables the original table for ingestion.
During this process, you can continue to query the existing data in the original table. However, changes to the data in the ServiceNow table won’t be reflected in the Snowflake table until the ingestion process completes.
To avoid overloading your ServiceNow instance, reload only one table at time.
Canceling Table Reload¶
To cancel the process of reloading the data in a table, use the CANCEL_RELOAD_TABLE
stored procedure as
shown in the following example:
CALL CANCEL_RELOAD_TABLE('<table_name>');
Where:
table_name
Specifies the name of the table whose reload you want to cancel.
When you cancel the reload, the connector drops all temporary objects created during the reload. The table is then available for ingestion as part of the normal synchronization schedule.