Kater CLI Make and compare new
kater new semantic-model
Makes a semantic model file to a connection's shared layer.
Start it from your SQL, from one shared dataset or model, or as a copy of another semantic model. A create needs --target-path and --name, and --dry-run shows the file first. A semantic model joins Kater datasets, and other semantic models, into one place to analyze. See Semantic models.
Examples
# Go to a connection's shared layer in your local copy of Kater contentcd connections/snowflake_prod_connection/modeling# Start a semantic model from the google_ads__campaign_report dataset, with all its fieldskater new semantic-model --target-path kater_objects/semantic_models/marketing --name google_ads_campaigns --base kater_dataset.google_ads__campaign_report# Add a semantic model from the SQL in a filekater new semantic-model --target-path kater_objects/semantic_models/marketing --name google_ads_campaigns --sql-file ~/google_ads_campaigns.sql# Copy the ad_reporting model under a new namekater new semantic-model --target-path kater_objects/semantic_models/marts --name ad_reporting_finance --duplicate-from ad_reporting# See the file it would write, and write nothingkater new semantic-model --target-path kater_objects/semantic_models/marketing --name google_ads_campaigns --base kater_dataset.google_ads__campaign_report --dry-runOptions
It also takes the global options --json, --kater-root, --scope and --help.
What it writes
- One file. The file is
NAME.sqlin the target folder, such askater_objects/semantic_models/marketing/google_ads_campaigns.sql. Kater writes its frontmatter. - From a base. With
--base, the SQL reads the base under a short name, and passes every field that the base publishes through. The base must compile now, and it must publish fields. - From your SQL. With
--sql-file, Kater checks the SQL before it writes. When the SQL has an error, Kater writes nothing and lists the problems. - Empty. With none of
--sql-file,--baseor--duplicate-from, the file holds only its frontmatter, and you write its SQL. - The answer. It gives the new file’s path,
authored_path, and the model’s id,object_id.
Names and access
- A new name. The name must be new among the connection’s semantic models. Kater never adds a number to make a name new.
- The naming rule. A name starts with a letter or
_, and holds letters, digits,_,$and-, up to 128 characters. - Edit access. You need edit access to the connection’s
modeling/folder. - Readable files. To check the name, Kater reads every SQL file in
modeling/. It stops when one has frontmatter that it cannot read. - In a local copy. The file is on your computer only. Commit it and run
kater git pushto publish it.
Check a dry run, then create
- Run the create with
--dry-run --json. It writes nothing. - Read the file path and the name that it proposes, and the revisions in
witnesses. - Run the create without
--dry-run, with those revisions, such as--namespace-revision. The create stops when something changed after the dry run.
The revision options work only on a create that writes, not with --dry-run. See Create commands.