Skip to main content
On this page

Kater CLI Find and understand model

kater model inspect

Checks a model file for problems, as an editor does, and lists each problem with its place in the file.

With --feature, it gives other things an editor shows, such as the hover text at a place. Nothing is saved, and nothing runs on the warehouse.

Examples

Terminal window
# Go to the snowflake_prod_connection connection
cd connections/snowflake_prod_connection
# Check the spend_by_platform query for problems
kater model inspect workspaces/ad_reporting/query_contracts/spend_by_platform.sql
# Get the hover text of sum__spend, at line 8, character 18, counted from 0
kater model inspect workspaces/ad_reporting/query_contracts/spend_by_platform.sql --feature hover --at 8:18
# Get the query's fields and tags in one step
kater model inspect workspaces/ad_reporting/query_contracts/spend_by_platform.sql --feature fields --feature tags
# List the tests in the shared test file of the ad_reporting model
kater model inspect modeling/kater_objects/tests/ad_reporting.sql --feature tests

Arguments

ArgumentDescription
<path>Optional. The model’s file. Or a workspace folder, with --model to select the model in it.

Options

OptionDescription
--model <model>The model to check, for a file that declares several, or in place of PATH, such as query.spend_by_platform.
--text-file <file>Text to check in place of the saved file, such as an editor’s unsaved changes. Kater still reads it as the file at PATH. - reads stdin.
--at <line>:<character>A place in the file, for a feature such as hover. Lines and characters count from 0, and characters count in UTF-16 code units.
--feature <feature>What to get in place of the file’s problems, such as hover or fields. See Features. You can give it more than one time.

It also takes the global options --json, --kater-root, --scope and --help.

Features

With no --feature, it lists the file’s problems, which is the diagnostics feature. Give --feature to get something else that an editor shows. Give it again for each feature you want.

The features are diagnostics, hover, definition, fields, tags, completions, signature_help, formatting, execution_scope, contract, definition_cards, definition_uses, field_menus, statements, tests, references, symbols, lenses, joins and definition_outline.

  • completions, signature_help and references need --at.
  • hover gives the hover text at the place in --at.
  • formatting gives the edits that format the file.

Statements in a scratch file

On a scratch file, --feature statements lists each statement’s range, title, fingerprint, route and reads. With --at, it also lists the fields that the statement at that place reads.

Tests in a test file

On a test file, --feature tests lists each test as the file’s own parse reads it. Each test shows its range, name, paths, expectation, picker, SQL, other query and expected rows. It also shows where each cell is written. With --at, it also lists the model’s fields that the test at that place names.

See also