Unify and manage your data

Create Snowflake Objects for Activity logs export

Learn how to use the Scripts API to create Snowflake Objects required for setting up activity log export in Snowflake.

Use the Scripts API to fetch SQL scripts to create the Snowflake objects required for activity log export. Run each of the following API requests individually.

HTTP method and endpoint

The following endpoints are used to fetch the SQL scripts to create Snowflake objects. Each of these endpoints must be called separately. The scripts are returned one at a time.

Use the following HTTP method and endpoint path to fetch the SQL scripts to create table in Snowflake.
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/snowflake/scripts?name=db.tables.create-table-activities
Use the following HTTP method and endpoint path to fetch the SQL scripts to create streams in Snowflake.
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/snowflake/scripts?name=db.streams.create-stream-activitiesstream
Use the following HTTP method and endpoint path to fetch the SQL scripts to create tasks in Snowflake.
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/snowflake/scripts?name=db.tasks.create-task-activitiestask
Use the following HTTP method and endpoint path to fetch the SQL scripts to create views in Snowflake.
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/snowflake/scripts?name=db.views.create-view-activeactivities

Request headers

The following request headers must be included.
HeaderRequiredDescription
AuthorizationYesAuthentication access token in the format Bearer <accessToken>.

Request body

You can use the API with or without a request body. If you include a request body, the response contains the Snowflake objects mentioned in the request body. If request body is not provided, the response will contain placeholders for <database>, <schema> and <landingTableName>, which you must replace with your Snowflake objects before executing the script in your Snowflake account.

The following table describes the request body parameters, including example values:
ParameterTypeRequiredDescriptionExample Values
databaseStringYesDatabase name in SnowflakeExample: LocalDB
schemaStringYesSchema name in SnowflakeExample: PUBLIC
landingTableNameStringYesName of the activity landing table in Snowflake Example: landingTable

Example: with request body

Request:
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/{{adapterName}}/scripts?name=db.views.create-view-activeactivities
Request body:
{
    "database":"DATABASE",
    "schema":"PUBLIC"
}
Response:
CREATE
OR REPLACE VIEW "activeActivities"
AS
SELECT *
FROM DATABASE.PUBLIC."activities"
WHERE "active" = TRUE;

Example: without request body

Request:
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/{{adapterName}}/scripts?name=db.views.create-view-activeactivities
Response:
CREATE
OR REPLACE VIEW "activeActivities"
AS
SELECT *
FROM <database>.<schema>."activities"
WHERE "active" = TRUE;