Skip to content

Commit

Permalink
Add instructions for callable
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jsummer committed Jan 2, 2025
1 parent 273312e commit 2bef25f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If you want to see what a semantic model looks like, skip to [Examples](#example
* [Streamlit in Snowflake Deployment](#streamlit-in-snowflake-deployment)
* [Local Deployment](#local-deployment)
* [Partner Tool Translation](#partner-tool-translation)
* [Callable Semantic Generation](#callable-semantic-generation)
* [Usage](#usage)
+ [Semantic Model Context Length Constraints](#semantic-model-context-length-constraints)
+ [Auto-Generated Descriptions](#auto-generated-descriptions)
Expand Down Expand Up @@ -207,6 +208,33 @@ Please see below for details about current partner support.
| DBT SQL Model | DBT SQL Models should be materialized in Snowflake with persist docs to capture comments. A new semantic file can be generated for these newly materialized tables/views in Snowflake directly.| |
| Looker Explore | We materialize your Explore dataset in Looker as Snowflake table(s) and generate a Cortex Analyst semantic file. Metadata from your Explore fields can be merged with the generated Cortex Analyst semantic file. | Looker Views referenced in the Looker Explores must be tables/views in Snowflake. Looker SDK credentials are required. Visit [Looker Authentication SDK Docs](https://cloud.google.com/looker/docs/api-auth#authentication_with_an_sdk) for more information. Install Looker's [API Explorer extension](https://cloud.google.com/looker/docs/api-explorer) from the Looker Marketplace to view API credentials directly. |

## Callable Semantic Generation

A semantic model for table(s) can be generated in a callable fashion using the below stored procedure:

```sql
CORTEX_ANALYST_SEMANTICS.SEMANTIC_MODEL_GENERATOR.GENERATE_SEMANTIC_FILE(
STAGE_NAME STRING,
MODEL_NAME STRING,
SAMPLE_VALUE INT,
ALLOW_JOINS BOOLEAN,
TABLE_LIST ARRAY
)
```

Calling the stored procedure will generate and upload a **minimal** semantic model YAML file to the specified Snowflake stage. Below is an example of calling the stored procedure for a single table.

```sql
CALL CORTEX_ANALYST_SEMANTICS.SEMANTIC_MODEL_GENERATOR.GENERATE_SEMANTIC_FILE(
'CATRANSLATOR.ANALYTICS.DATA',
'MY_SEMANTIC_MODEL',
5,
False,
['CATRANSLATOR.ANALYTICS.CUSTOMERS']
);
```
Please note that high accuracy generally requires hands-on curation beyond that of a minimal semantic model.

## Usage

### Semantic Model Context Length Constraints
Expand Down

0 comments on commit 2bef25f

Please sign in to comment.