GoodData CLI
GoodData for VS Code and GoodData CLI are available for you to try out and provide feedback. Avoid using those in a production environment.
Manage your analytics as code. The solution consists of two components:
Together these tools allow you to:
- Retrieve analytical objects from a GoodData server.
- Create or update analytical objects in Visual Studio Code.
- Test analytical objects locally in Visual Studio Code.
- Deploy analytical objects to a GoodData server of your choice.
The analytical objects you can work with include datasets, which form the logical data model, and metrics. Additionally, we have plans to incorporate support for visualizations in the near future.
With GoodData CLI you can:
- Initialize a new project.
- Clone existing analytical project from GoodData server.
- Validate the analytical project, for example, in CI pipelines.
- Deploy the analytical project to GoodData server.
Prerequisites
Before getting started, ensure that you have:
Install CLI
In terminal, run npm i -g @gooddata/code-cli
.
You should have a new CLI command available, try running gd -v
or gd --help
.
gd init
command
Once the CLI is installed you are able to initialize your project locally.
Steps:
- Open a terminal and navigate to a folder where you want to build and store your analytics.
- To initialize your project, run
gd init
and follow the instructions to create a gooddata.yaml
definition file. - Create a
.env
file in the same folder as gooddata.yaml
and add an environmental variable that stores
your API access token. For example:GD_API_TOKEN="fd6f9a71541856b4c9617f74a8576e131"
.
Make sure you do not store the .env
file in you version control system (like Git).
For example, you can add the file to .gitignore
.
gd clone
command
To clone your GoodData analytical environment to your local machine, run gd clone
.
You should now have an analytics
folder that contains your datasets
and metrics
.
gd validate
command
GoodData CLI can run validation on your project. This is useful if you want to set up CI/CD pipelines
and, for example, ensure the project is valid before merging a pull request.
GoodData CLI will validate that:
- syntax of the YAML files is correct;
- there are no missing or unsupported properties;
- references between dataset and metrics are valid; and
- references to the database tables and columns are valid.
To execute validation, run gd validate
.
gd deploy
command
GoodData CLI can deploy your analytical project to the GoodData server defined in gooddata.yaml
file.
To execute the deployment, run gd deploy
.
Before deploying the project, GoodData CLI will also run validation, unless --no-validate
argument was passed to the command.