> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Save To Table Variant

> Documentation for the Save To Table Variant action for Snowflake

![images/snowflake.svg](https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/snowflake.svg?fit=max\&auto=format\&n=EU2WCxuXGIUQcziR\&q=85\&s=1332888aadd70b1a7efc346816602e2b)

## Getting Started

Automate your healthcare workflows with Snowflake integrations and Morf. Snowflake is a cloud-based data warehousing platform for analyzing and querying large datasets. Save event data from a Morf workflow to a Snowflake table.

## Creating the Morf role, warehouse, and database in Snowflake

Replace the first line of the following script, then run it:

```sql theme={null}
set morfPassword = '<MORF_PASSWORD>'; -- ⚠️ Replace me with a strong password

begin;

-- create Morf role
use role securityadmin;
create role if not exists MORF_HEALTH;
grant role MORF_HEALTH to role sysadmin;

-- create Morf user
create user if not exists MORF_HEALTH
    password = $morfPassword
    default_role = 'MORF_HEALTH'
    default_warehouse = 'MORF_HEALTH';

grant role MORF_HEALTH to user MORF_HEALTH;

-- change role to sysadmin for warehouse / database steps
use role sysadmin;

-- create Morf warehouse
create warehouse if not exists MORF_HEALTH
    warehouse_size = xsmall
    warehouse_type = standard
    auto_suspend = 60
    auto_resume = true
    initially_suspended = true;

-- create Morf database
create database if not exists MORF_HEALTH;

-- grant Morf warehouse access
grant usage
    on warehouse MORF_HEALTH
    to role MORF_HEALTH;

-- grant Morf database access
grant ownership
    on database MORF_HEALTH
    to role MORF_HEALTH;

-- grant Morf schema access
grant ownership
    on schema MORF_HEALTH.PUBLIC
    to role MORF_HEALTH;

commit;
```

# Parameters

**Action** `Parameters`

**parameters**

**Database Name** `string`

This field maps to the destination API `databaseName` field.

**Schema Name** `string`

This field maps to the destination API `schemaName` field.

**Table Name** `string`

This field maps to the destination API `tableName` field.

**Fields** `Map\<string,dynamic (any)\>`

`HI` `ID` `PII`
This field maps to the destination API `fields` field.

**Additionally Include Event Fields At The Top Level** `bool`

This field maps to the destination API `additionallyIncludeEventFieldsAtTheTopLevel` field.

```json Result Object Example theme={null}
{
  "$result_object_key": {
    "table_used": {
      "database_name": "MORF_HEALTH",
      "schema_name": "PUBLIC",
      "table_name": "HEALTHIE_PATIENT_UPDATED"
    }
  }
}
```

```json Result Object Description theme={null}
{
  "$result_object_key": {
    "table_used": {
      "database_name": "Database Name",
      "schema_name": "Schema Name",
      "table_name": "Table name used to save the data"
    }
  }
}
```

### Result Object Field Details

You can use the result of the action's data as inputs to downstream workflow actions.

Each fetch action requires an object name, which nests the action's result data inside the downstream data context in the workflow. See [Passing Data Between Actions](https://docs.morf.health/docs/knowledge_base/passing_data_between_actions.md) for how to set it and reference the result from downstream nodes.

Here we demonstrate how to refer to this data using the prefix `$result_object_key`.

**SaveToTableVariantResponse** `Fetch Action Response Object`

**fields**

**table\_used** `object` *required*

*Description coming soon*

```json CEL theme={null}
$result_object_key.table_used
```

```json Example theme={null}
{
"database_name": "MORF_HEALTH",
"schema_name": "PUBLIC",
"table_name": "HEALTHIE_PATIENT_UPDATED"
}
```

**table\_used.database\_name** `string` *required*

Database Name

```json CEL theme={null}
$result_object_key.table_used.database_name
```

```json Example theme={null}
"MORF_HEALTH"
```

**table\_used.schema\_name** `string` *required*

Schema Name

```json CEL theme={null}
$result_object_key.table_used.schema_name
```

```json Example theme={null}
"PUBLIC"
```

**table\_used.table\_name** `string` *required*

Table name used to save the data

```json CEL theme={null}
$result_object_key.table_used.table_name
```

```json Example theme={null}
"HEALTHIE_PATIENT_UPDATED"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.