CLI Reference¶
How to Use¶
The basic syntax of executing a command is:
wht <command> <subcommand> [parameters]
help¶
Provides information on any command.
Command
wht help
Get list of all the commands.
Subcommand
wht help <command name>
Get usage information for a specific command, with subcommands and optional parameters.
init¶
Create profile and initialize projects.
Subcommands
wht init profile
This will input values for connections profile and then store it in siteconfig.yaml file at .wht folder of home directory.
wht init wht-project
This will generate files in a folder named HelloWhtProject with sample data, that you can change as per project information, models, etc.
wht init goapp-project
TBD, this will initialize a data app project in GO.
wht init ml-project
TBD, this will initialize an ML project.
Optional Parameters
To create a wht-project with name different than HelloWhtProject, specify it as an additional parameter at end of command.
wht init wht-project SomeOtherProject
This will create wht-project in the folder SomeOtherProject
.
compile¶
Generates SQL queries from models.
Command
wht compile
This will create SQL queries from the model YAML file, storing the generated results in output subfolder of the project’s folder. With each run, a new folder will be created inside it, with name being the number indicating the models were run. You can manually execute these SQL files on the warehouse.
Optional Parameters
clean_output
This will empty the output folder(s) before executing the command.
-c
In case you want to use a site config file other than the one in ~/.wht/ directory. An example of how to use:
wht compile -c MyOtherProfile/siteconfig.yaml
-t
You can use it to define target name (as mentioned in siteconfig.yaml) or the timestamp in building the model.
Say your siteconfig.yaml has two targets, dev and test, and you want to use the test instance:
wht compile -t test
When you want to fetch all the data in source tables:
wht compile -t timeless
-w
In case you want to use a project file other than the one in current directory:
wht compile -w MyOtherProject/wht-project.yaml
run¶
Creates ID Stitched or Feature Table on the Warehouse.
Command
wht run
This will genrate the SQL from model files and also execute it on the warehouse. After the command execution is complete, you can see the names of output tables on the screen, which you can access from the warehouse.
Optional Parameters
Same as in compile
command, with these addtional parameters:
--force
It will do a force run, even if the material already exists.
-w
Write all the generated tables to CSV files in the specified directory.
wht compile -w WriteOutputHere/
--model_args
Use this to customise behavior of any individual model by passing configuration params to it. Different model types support different params. The only argType supported currently is breakpoint
for models of type feature_table_model
.
The parameter breakpoint
allows you to generate and run SQL only till a specific feature/tablevar. It is specified in the format modelName:argType:argName
where argName is the name of feature/tablevar. For example:
wht run --model_args domain_profile:breakpoint:salesforceEvents
discover¶
Discovers elements in the warehouse, such as models, entities, features and sources.
Command
wht discover
This allows you to discover all the registered elements in the warehouse.
Subcommands
wht discover models
Here you can discover all the models in the warehouse.
You can change parameter in the above command to discover all the entities
, features
and sources
in the warehouse.
wht discover entities
wht discover features
wht discover sources
Optional Parameters
-e
If you want to discover specific entities with that name.
wht discover -e 'TheName'`
-m
To discover a specific model.
wht discover -m 'MY_DATABASE.PROD_SCHEMA.CREATED_MODEL'
-c
To use a site config other than the default one. Extending the previous example to show a combination of both:
wht discover -m 'MY_DATABASE.PROD_SCHEMA.CREATED_MODEL' -c siteconfig.yaml
-s
To discover entities in a specified schema.
-u
Discover the entities having these source URL’s. Say you want to discover all the entities coming from GitHub:
wht discover -u %github%
-t
You can use it to define target name (as mentioned in siteconfig.yaml).
-w
Use a project file other than the one in current directory.
wht discover -w SomeOtherProject/wht-project.yaml
-f
Specify this flag with a file path to dump the discovery output into a csv file
wht discover -f path/to/csv_file.csv
validate¶
Validates aspects of the project and configuration.
Command
wht validate
This command allows you to run various tests on the project related configurations and validate those. This includes but is not limited to validating the project configuration, privileges associated with the role specified in the site configuration of the project’s profile, etc.
Subcommands
wht validate access
This will run tests on the role specified in site configuration of the project’s profile and validate if the role has privileges to access all the related objects in the warehouse. This will throw error if the role does not has privileges to access the input tables or does not has permissions to write the material output in the output schema.