Kater CLI Make and compare new
kater new db-dataset
Makes the DB dataset file for one warehouse table, from the table's CREATE TABLE statement.
kater sync --resource-type db_dataset usually writes these files for you, so use this command for a table that sync has not written yet. The next sync takes the file over. It does not read or change your warehouse. See DB datasets.
Examples
# Go to a connection's folder in your local copy of Kater contentcd connections/snowflake_prod_connection# See the name and the file that the returns table would get, and write nothingkater new db-dataset --target-path modeling/db_objects/datasets --sql-file returns.sql --dry-run# Add the DB dataset for the returns tablekater new db-dataset --target-path modeling/db_objects/datasets --name returns --label Returns --sql-file returns.sql# Let sync take the file over and profile its columnskater sync --resource-type db_dataset --scope modelingOptions
It also takes the global options --json, --kater-root, --scope and --help.
The statement
The examples read the table’s statement from returns.sql. It names the table in full and lists its columns:
CREATE TABLE shop.sales.returns (order_id INTEGER, returned_at TIMESTAMP, amount DECIMAL(10, 2));What it writes
- The file that sync keeps for the table. The file is
modeling/db_objects/datasets/DATABASE/SCHEMA/TABLE.sql, whatever its name, such asmodeling/db_objects/datasets/shop/sales/returns.sql. - The frontmatter. Kater writes the name, the label and the description that you give, and the table’s
database,schemaandtablekeys. The first line is the header that sync writes. See DB datasets. - Your statement. Kater checks it before it writes. When it has an error, Kater writes nothing.
- The answer. It gives the new file’s path,
authored_path, and the model’s id,object_id.
When Kater refuses it
- The SQL is not one
CREATE TABLEstatement that names the table in full. connection.yamldoes not select the table. Add the table toconnection.yamlfirst.- Another DB dataset already describes the table. Open that file instead.
--target-pathis not on the way to the table’s file. The message names the folder to give.
After you create it
The next kater sync --resource-type db_dataset takes the file over and lists it under Adopted. It writes the DDL from the warehouse, profiles the columns, and keeps the name, the label and the description. When the warehouse has no such table, sync keeps the file, gives a warning, and never deletes it. See Files that sync did not write.
Names and access
- A new name. The name must be new among the connection’s DB datasets. 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. - In a local copy. The file is on your computer only. Commit it and run
kater git pushto publish it.
See Create commands.