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
# Go to the snowflake_prod_connection connectioncd connections/snowflake_prod_connection# Check the spend_by_platform query for problemskater 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 0kater 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 stepkater 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 modelkater model inspect modeling/kater_objects/tests/ad_reporting.sql --feature testsArguments
Options
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_helpandreferencesneed--at.hovergives the hover text at the place in--at.formattinggives 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.