Manage the Semarchy Native App
This page provides SQL commands for monitoring, operating, and maintaining the Semarchy Native App on Snowflake.
|
The Native App supports two repository modes:
Repository-related commands on this page, such as the repository log, backup, and restore procedures, apply only to the embedded repository mode. All other commands, including the procedure that drops obsolete data location tables, apply to both repository modes. For more information on repository modes, see Install:snowflake/deploy-in-snowflake.adoc#_select_the_repository_mode. |
| The README file available in the Native App settings provides usage examples for each procedure. |
Initial setup and verification
Configure parameters
To update Native App configuration parameters, run:
CALL <native_app_name>.xdm_public.reload_app(<params>);
The reload_app procedure restarts the xDM service, which causes a short service interruption.
|
The <params> argument is a JSON object (VARIANT) containing configuration keys used to update the Native App configuration. These keys are grouped into two categories:
-
Application configuration parameters, which control how the Native App runs.
-
Repository connection parameters, which define how the Native App connects to the repository in external repository mode.
|
Parameter behavior
For each key in
|
Application configuration parameters
Key |
Description |
|
Additional JVM options for the Semarchy application container. For more information, see Configure JVM options. |
|
The allowed origins for the UI endpoint. Required to enable CORS. |
|
The allowed HTTP methods for CORS. |
|
The allowed request headers for CORS. |
|
The response headers exposed to the browser. |
|
A a Boolean flag indicating whether Snowflake platform metrics collection is enabled for the running xDM service (default: |
|
The size (in GB) of the block storage volume for the repository container (default: |
|
The maximum input/output operations per second (IOPS) supported for the repository storage (default: |
|
The peak throughput (in MiB/s) supported for the repository storage (default: |
* Storage-related parameters apply only to the embedded repository mode and are ignored when using an external repository.
Configure JVM options
Use the catalina_opts parameter to pass JVM options to the Semarchy application container.
To update the JVM options for the Native App, run:
CALL <native_app_name>.xdm_public.reload_app(
OBJECT_CONSTRUCT(
'catalina_opts',
'-D<property_name>=<value>'
)
);
Changes to catalina_opts take effect after the Native App reloads.
|
To configure multiple JVM options, provide them as a single string, separated by spaces:
CALL <native_app_name>.xdm_public.reload_app(
OBJECT_CONSTRUCT(
'catalina_opts',
'-D<property_name_1>=<value_1> -D<property_name_2>=<value_2>'
)
);
To reset the JVM options to their default state, run:
CALL <native_app_name>.xdm_public.reload_app(
OBJECT_CONSTRUCT_KEEP_NULL(
'catalina_opts',
null
)
);
| For details on how null values are handled, see Parameter behavior. |
Configure CORS parameters
Use the cors_allow_origin, cors_allow_methods, cors_allow_headers, and cors_expose_headers parameters to control cross-origin resource sharing (CORS) for the Native App user interface endpoint.
To enable CORS and configure the allowed origins, methods, and headers, run:
CALL <native_app_name>.xdm_public.reload_app(
{
'cors_allow_origin': ['<allowed_origin_url_1>', '<allowed_origin_url_2>'],
'cors_allow_methods': ['<http_method_1>', '<http_method_2>'],
'cors_allow_headers': ['<request_header_1>', '<request_header_2>'],
'cors_expose_headers': ['<response_header_1>', '<response_header_2>']
}::VARIANT
);
| Changes to CORS parameters take effect after the Native App reloads. |
To disable CORS, clear all CORS parameters by passing null for each key:
CALL <native_app_name>.xdm_public.reload_app(
OBJECT_CONSTRUCT_KEEP_NULL(
'cors_allow_origin', null,
'cors_allow_methods', null,
'cors_allow_headers', null,
'cors_expose_headers', null
)
);
Repository connection parameters
Key |
Description |
|
The JDBC URL of the external repository. If |
|
The PostgreSQL user for the repository. Stored as a Snowflake Secret. If not provided, the previously saved value is retained. Can be cleared by passing |
|
The password for the repository user. Stored as a Snowflake Secret. If not provided, the previously saved value is retained. Can be cleared by passing |
|
The PostgreSQL read-only user. Stored as a Snowflake Secret. If not provided, the previously saved value is retained. Can be cleared by passing |
|
The password for the read-only user. Stored as a Snowflake Secret. If not provided, the previously saved value is retained. Can be cleared by passing |
Monitor the Native App
Check service status
To check the status of the Native App services, run:
CALL <native_app_name>.xdm_public.service_status();
For users who only need to check service status and view logs, granting the DM_MONITOR application role avoids giving them administration privileges. For more information, see Grant monitoring access.
|
View application logs
To display logs from the xDM application container:
CALL <native_app_name>.xdm_public.xdm_server_logs([<number_of_lines>]);
View repository logs
To display logs from the repository container (embedded repository mode only):
CALL <native_app_name>.xdm_public.xdm_repo_logs([<number_of_lines>]);
| In external repository mode, repository logs are not available through Native App procedures. Logs must be accessed through the database platform hosting the external repository. |
Collect platform metrics
The Native App can publish container-level metrics for the xDM service to the event table of the Snowflake account. Metric collection is disabled by default.
|
When metric collection is enabled, Snowflake records the following metric groups:
Metrics remain in the event table of your own Snowflake account. The Native App does not expose any procedure to read them. To read them, use the Snowflake Container logs are not exported to the event table. To view logs, use the log procedures described in [_monitor_the_native_app]. Metrics cover the running xDM service only. |
Enable platform metrics collection
To enable platform metrics collection:
-
Ensure that an event table is set as the active event table for your Snowflake account. For more information, see the official Snowflake documentation.
-
Run the following procedure to reload the Native App with the
platform_metricsparameter set toTRUE:CALL <native_app_name>.xdm_public.reload_app(OBJECT_CONSTRUCT('platform_metrics', TRUE));The reload_appprocedure restarts the xDM service, which causes a short service interruption.The platform_metricsvalue is saved with the other configuration parameters. It is preserved across reloads, version upgrades, and repository mode switches.
Setting platform_metrics to true in the <params> argument of the startup procedure enables metric collection from the first startup, without a later reload. For more information, see Install:snowflake/deploy-in-snowflake.adoc#start-native-app.
|
Disable platform metrics collection
To stop collecting platform metrics, run the following procedure to reload the Native App with the platform_metrics parameter set to FALSE:
CALL <native_app_name>.xdm_public.reload_app(OBJECT_CONSTRUCT('platform_metrics', FALSE));
The reload_app procedure restarts the xDM service, which causes a short service interruption.
|
| Metric collection stops when the reload completes. |
Grant monitoring access
The Native App exposes a read-only DM_MONITOR application role that lets users monitor the xDM service without administration privileges.
To grant monitoring access, run:
GRANT APPLICATION ROLE <native_app_name>.DM_MONITOR TO ROLE <account_role_name>;
|
The
It does not grant access to administration procedures (such as |
Query platform metrics
To query the platform metrics of the xDM service:
-
Sign in to Snowflake with a role that holds the
DM_MONITORapplication role. -
Run the following query:
SELECT * FROM TABLE(<native_app_name>.XDM_APP_SCHEMA.xdm!SPCS_GET_METRICS());The
SPCS_GET_METRICSfunction is called on thexdmservice, which is in theXDM_APP_SCHEMAschema. TheXDM_PUBLICschema only contains the Native App procedures.For information about the available query options and the returned metrics, see the official Snowflake documentation.
ExampleTo return the metrics recorded over the last three days, run:
SELECT * FROM TABLE(<native_app_name>.XDM_APP_SCHEMA.xdm!SPCS_GET_METRICS( start_time => DATEADD('day', -3, CURRENT_TIMESTAMP()) ));
Platform metrics can also be retrieved by querying the event table directly instead of using SPCS_GET_METRICS. This requires privileges on the event table, which the DM_MONITOR application role does not grant. For more information, see the official Snowflake documentation.
|
Backup and restore
|
Repository backup and restore operations are available only in embedded repository mode. When using an external repository, backup and recovery must be managed using the capabilities of the database platform hosting the repository. |
Create a backup
To create a backup of the embedded repository, run:
CALL <native_app_name>.xdm_public.xdm_repo_backup(<backup_name>);
|
To ensure the backup operation succeeds, the backup name must follow Snowflake identifier naming rules. It must start with a letter and may contain only letters, numbers, and underscores; spaces, hyphens, and other special characters are not allowed. For more information, see the official Snowflake documentation. |
Drop obsolete data location tables
The drop_datalocation_tables procedure removes specified tables owned by the Native App from a data location when a model change makes the tables obsolete or requires their recreation.
The drop_datalocation_tables procedure behaves identically in embedded and external repository modes. In both modes, the Native App owns the tables in a data location.
|
|
The Native App must retain ownership of data location tables and
|
The procedure requires the following:
-
The
XDM_APPapplication role, granted to the Snowflake role used to call the procedure. To grant that role, run:GRANT APPLICATION ROLE <native_app_name>.XDM_APP TO ROLE <account_role_name>; -
A warehouse in use in the current session.
-
The Native App grants on the data location database and schema. For more information, see Prepare Snowflake resources for each datasource.
Drop the tables and redeploy the model
To drop obsolete data location tables:
-
Identify the tables to drop in the data location schema. For information about the tables created for a model, see Data hub table structures.
Dropping a table is irreversible. Data location tables are Snowflake hybrid tables, which do not support
UNDROPor the Snowflake Time Travel feature. All data stored in a dropped table is permanently lost, even when the model change affects only part of the table.Repository backups created with
xdm_repo_backupdo not include data location tables. -
Call the procedure with the data location database, schema, and an array of table names.
ExampleTo drop two tables for a Customer entity, run the following call. Replace the database and schema placeholders and the example table names with the values for your data location:
CALL <native_app_name>.xdm_public.drop_datalocation_tables( '<data_location_database_name>', '<data_location_schema_name>', ARRAY_CONSTRUCT('SD_CUSTOMER', 'GD_CUSTOMER') );-
Each database, schema, and table name passed to the procedure must be an unqualified identifier without embedded quotes. Do not include a database or schema qualifier in a name, or pass table names as a comma-separated string instead of an array.
-
xDM infrastructure tables, whose names start with
DL_orMTA_, cannot be dropped. Naming one rejects the entire call before any table is dropped. -
Tables that do not exist or are not owned by the Native App are skipped.
-
Foreign keys that reference a dropped table from surviving tables are dropped with it. The order of the table names in the array has no effect.
-
-
Review the returned report and confirm that the intended tables were dropped. For the report fields and statuses, see Interpret the drop report.
-
If the intended tables were dropped, redeploy the model edition to the data location. For more information, see Deploy a model edition. Deployment recreates the dropped tables to match the updated model.
Interpret the drop report
The report contains a call-level status, counts, and dropped, skipped, and failed lists. The counts summarize the table results.
Call-level status
The status field has one of the following values:
-
OK: the requested tables were dropped. -
PARTIAL_SUCCESS: at least one table was dropped; the other tables were skipped, and no drop failed. See theskippedlist for the reason each table was skipped. -
PARTIAL_FAILURE: at least one drop failed during execution; other tables may have been dropped or skipped. See thefailedlist for the reason each drop failed. -
NOTHING_DROPPED: no table was dropped and no drop failed; all tables were skipped. See theskippedandfailedlists for the reason each table was skipped or failed. -
NOTHING_TO_DO: the table array was empty orNULL; no table was dropped. -
REJECTED: the whole call was refused before any table was dropped. The report gives one of the following reasons:-
INVALID_IDENTIFIER: a database, schema, or table name is not an unqualified identifier, or contains embedded quotes. Correct the name and run the procedure again. -
APPLICATION_DATABASE: the database argument targets the Native App’s own database instead of a data location database. Correct the argument and run the procedure again. -
PROTECTED_TABLE: the array includes an infrastructure table whose name starts withDL_orMTA_. Remove the table from the array and run the procedure again. -
SCHEMA_NOT_ACCESSIBLE: the schema does not exist, or the Native App cannot access it. Check the schema name. If the schema exists, restore the Native App’s grants on the data location, as described in Prepare Snowflake resources for each datasource.
-
Table results
The dropped, skipped, and failed lists identify the tables and give a reason for each result.
In the skipped list, specifically:
-
NOT_FOUNDmeans that the table does not exist in the target schema. -
NOT_OWNED_BY_APPLICATIONmeans that the table is owned by another role and cannot be dropped by the procedure.
Application lifecycle management
Suspend
To temporarily suspend all containers of the Native App, run:
CALL <native_app_name>.xdm_public.suspend_app();
Resume
To resume the Native App containers, run:
CALL <native_app_name>.xdm_public.resume_app();
| Resuming the Native App may upgrade the Native App containers to the latest available version. |
Reload
To restart the Native App and apply updated configuration parameters, run:
CALL <native_app_name>.xdm_public.reload_app(<params>);
The reload_app procedure restarts the xDM service, which causes a short service interruption.
|
The <params> argument is a JSON object (VARIANT) containing configuration keys.
For a list of supported parameters and their behavior, see Configure parameters.
When using reload_app, only the provided parameters are updated; all others retain their previously saved values.
|
Upgrade the Native App
Patch upgrades of the Native App are handled automatically. Configuration parameters are preserved and reapplied during upgrades.
To apply new configuration parameters outside of an upgrade, reload the Native App, as described in Reload.