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.
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/snowflake/scripts?name=db.tables.create-table-activitiesUse 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-activitiesstreamUse 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-activitiestaskUse 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-activeactivitiesRequest headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Authentication 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.
| Parameter | Type | Required | Description | Example Values |
|---|---|---|---|---|
database | String | Yes | Database name in Snowflake | Example: LocalDB |
schema | String | Yes | Schema name in Snowflake | Example: PUBLIC |
landingTableName | String | Yes | Name of the activity landing table in Snowflake | Example: landingTable |
Example: with request body
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/{{adapterName}}/scripts?name=db.views.create-view-activeactivities
{
"database":"DATABASE",
"schema":"PUBLIC"
}
CREATE
OR REPLACE VIEW "activeActivities"
AS
SELECT *
FROM DATABASE.PUBLIC."activities"
WHERE "active" = TRUE;
Example: without request body
POST {{hub-url}}/api/tenants/{{tenantID}}/adapters/{{adapterName}}/scripts?name=db.views.create-view-activeactivities
CREATE
OR REPLACE VIEW "activeActivities"
AS
SELECT *
FROM <database>.<schema>."activities"
WHERE "active" = TRUE;