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

# Snowflake Actions/run Semantic Query: Inputs, Cost & CLI

> Querying Snowflake through the stored organization semantic layer using Aero-compatible semantic query arguments. Includes inputs, outputs, and CLI examples.

## Run in Enrichment Spreadsheet

<Info>
  Use this function as a column step in `deepline enrich`.
</Info>

```bash theme={null}
deepline enrich --input leads.csv --output leads.enriched.csv --with 'result=snowflake_run_semantic_query:{}' --json
```

<Tip>
  Map payload values to spreadsheet columns with `{{column_name}}` placeholders.
</Tip>

## Input Schema

| Name                                | Type                            | Required | Default  | Description                                                  |
| ----------------------------------- | ------------------------------- | -------- | -------- | ------------------------------------------------------------ |
| `payload.credentials`               | `object`                        | No       |          |                                                              |
| `payload.name`                      | `string`                        | No       |          |                                                              |
| `payload.output_df_name`            | `string`                        | No       |          |                                                              |
| `payload.renderer_version`          | `"v2"`                          | No       |          |                                                              |
| `payload.type`                      | `"metrics" \| "funnel" \| null` | No       |          |                                                              |
| `payload.params`                    | `object \| null`                | No       |          |                                                              |
| `payload.table_name`                | `string`                        | No       |          | Legacy semantic table name.                                  |
| `payload.metrics`                   | `array`                         | No       |          |                                                              |
| `payload.dimensions`                | `array`                         | No       |          |                                                              |
| `payload.custom_dimensions`         | `array`                         | No       |          |                                                              |
| `payload.facts`                     | `array`                         | No       |          |                                                              |
| `payload.filters`                   | `array`                         | No       |          |                                                              |
| `payload.custom_filter_expressions` | `array`                         | No       |          |                                                              |
| `payload.rowLimit`                  | `integer`                       | No       | `5000`   | Maximum number of rows to return. Default 5000.              |
| `payload.timeoutMs`                 | `integer`                       | No       | `120000` | Snowflake statement timeout in milliseconds. Default 120000. |

### Allowed values

| Field                      | Allowed values      |
| -------------------------- | ------------------- |
| `payload.renderer_version` | `v2`                |
| `payload.type`             | `metrics`, `funnel` |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Render a stored Snowflake semantic layer query and execute it.",
    "properties": {
      "credentials": {
        "type": "object",
        "properties": {
          "account": {
            "type": "string",
            "description": "Snowflake account identifier."
          },
          "user": {
            "type": "string",
            "description": "Snowflake username."
          },
          "warehouse": {
            "type": "string",
            "description": "Warehouse to use for query execution."
          },
          "database": {
            "type": "string",
            "description": "Default database."
          },
          "schema": {
            "type": "string",
            "description": "Default schema."
          },
          "role": {
            "type": "string",
            "description": "Optional Snowflake role."
          },
          "password": {
            "type": "string",
            "description": "Password auth secret."
          },
          "private_key": {
            "type": "string",
            "description": "Private key auth secret."
          },
          "private_key_passphrase": {
            "type": "string",
            "description": "Optional private key passphrase."
          }
        },
        "required": [
          "account",
          "user",
          "warehouse",
          "database",
          "schema"
        ],
        "additionalProperties": false
      },
      "name": {
        "type": [
          "string",
          "null"
        ]
      },
      "output_df_name": {
        "type": [
          "string",
          "null"
        ]
      },
      "renderer_version": {
        "type": "string",
        "const": "v2"
      },
      "type": {
        "anyOf": [
          {
            "type": "string",
            "const": "metrics"
          },
          {
            "type": "string",
            "const": "funnel"
          },
          {
            "type": "null"
          }
        ]
      },
      "params": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "table_name": {
                "type": "string",
                "description": "Semantic table name."
              },
              "metrics": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "dimensions": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "custom_dimensions": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "facts": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "filters": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "custom_filter_expressions": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "output_format": {
                "type": "string",
                "enum": [
                  "csv",
                  "parquet"
                ]
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "table_name": {
                "type": "string",
                "description": "Semantic table name."
              },
              "steps": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "source_table": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "ts_expr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "time_dimension": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "filter_expr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "events_sql": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "cohort_by": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "enforce_order": {
                "type": "boolean"
              },
              "time_window_days": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "filters": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "custom_filter_expressions": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "output_format": {
                "type": "string",
                "enum": [
                  "csv",
                  "parquet"
                ]
              }
            },
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "table_name": {
        "type": "string",
        "description": "Legacy semantic table name."
      },
      "metrics": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "dimensions": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "custom_dimensions": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "facts": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "filters": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "custom_filter_expressions": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        }
      },
      "rowLimit": {
        "type": "integer",
        "description": "Maximum number of rows to return. Default 5000.",
        "default": 5000
      },
      "timeoutMs": {
        "type": "integer",
        "description": "Snowflake statement timeout in milliseconds. Default 120000.",
        "default": 120000
      }
    },
    "additionalProperties": false
  }
  ```
</details>

## Output Schema

| Name          | Type     | Required | Default | Description                      |
| ------------- | -------- | -------- | ------- | -------------------------------- |
| `result.data` | `object` | Yes      |         | Semantic query response payload. |
| `result.meta` | `object` | No       |         |                                  |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Snowflake semantic query result.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Semantic query response payload.",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "rowCount": {
            "type": "integer"
          },
          "limited": {
            "type": "boolean"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "queryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sql": {
            "type": "string"
          },
          "dataset": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "snowflake_query"
              },
              "total_rows": {
                "type": "integer"
              },
              "returned_limit": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              },
              "page_size": {
                "type": "integer"
              }
            },
            "required": [
              "kind",
              "total_rows",
              "returned_limit",
              "offset",
              "page_size"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "rows",
          "rowCount",
          "limited",
          "columns",
          "queryId",
          "sql"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "properties": {
          "database": {
            "type": "string"
          },
          "schema": {
            "type": "string"
          },
          "warehouse": {
            "type": "string"
          },
          "rowLimit": {
            "type": "integer"
          },
          "timeoutMs": {
            "type": "integer"
          },
          "rendererVersion": {
            "type": "string",
            "const": "v2"
          },
          "semanticLayerHash": {
            "type": "string"
          }
        },
        "required": [
          "database",
          "schema",
          "warehouse",
          "rowLimit",
          "timeoutMs",
          "rendererVersion",
          "semanticLayerHash"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Advanced: Direct CLI

<Info>
  Use direct execution for single payload debugging.
</Info>

```bash theme={null}
deepline tools execute snowflake_run_semantic_query --payload '{}' --json
```

### CLI flags

| Flag                        | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `--json`                    | Print machine-readable output.                      |
| `--wait`                    | Wait for terminal provider status when supported.   |
| `--debug`                   | Enable wait mode with additional status/log output. |
| `--wait-timeout SECONDS`    | Max seconds to wait in wait mode.                   |
| `--poll-interval SECONDS`   | Polling interval in seconds during wait mode.       |
| `--timeout SECONDS`         | Request timeout in seconds.                         |
| `--connect-timeout SECONDS` | Connection timeout in seconds.                      |

## Cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.
* Billing mode: `no_bill`.
