How to initialize a new Data Context with the CLI
Prerequisites: This how-to guide assumes you have:
- Completed the Getting Started Tutorial
- A working installation of Great Expectations
- Configured a Data Context
Steps​
1. Initialize your Data Context with the CLI​
The simplest way to create a new Data ContextThe primary entry point for a Great Expectations deployment, with configurations and methods for all supporting components. is by using Great Expectations' CLI.
From the directory where you want to deploy Great Expectations run the following command:
great_expectations init
You should be presented with this output and prompt:
Using v3 (Batch Request) API
___ _ ___ _ _ _
/ __|_ _ ___ __ _| |_ | __|_ ___ __ ___ __| |_ __ _| |_(_)___ _ _ ___
| (_ | '_/ -_) _` | _| | _|\ \ / '_ \/ -_) _| _/ _` | _| / _ \ ' \(_-<
\___|_| \___\__,_|\__| |___/_\_\ .__/\___\__|\__\__,_|\__|_\___/_||_/__/
|_|
~ Always know what to expect from your data ~
Let's create a new Data Context to hold your project configuration.
Great Expectations will create a new directory with the following structure:
great_expectations
|-- great_expectations.yml
|-- expectations
|-- checkpoints
|-- plugins
|-- .gitignore
|-- uncommitted
|-- config_variables.yml
|-- data_docs
|-- validations
OK to proceed? [Y/n]:
When you see the prompt to proceed, enter
Y
or simply press the
enter
key to continue. Great Expectations
will then build out the directory structure and
configuration files it needs for you to proceed.
2. Verify that your Data Context was initialized​
Once Great Expectations finishes executing your
great_expectations init
command,
verifying that your Data Context was created is as
simple as checking the contents of the folder that you
ran the init
command from.
After running the init
command, your
great_expectations
directory will contain
all of the important components of a local Great
Expectations deployment. This is what the directory
structure looks like:
-
great_expectations.yml
contains the main configuration of your deployment. -
The
expectations
directory stores all your as JSON files. If you want to store them somewhere else, you can change that later. -
The
plugins/
directory holds code for any custom plugins you develop as part of your deployment. -
The
uncommitted/
directory contains files that shouldn’t live in version control. It has a .gitignore configured to exclude all its contents from version control. The main contents of the directory are:-
uncommitted/config_variables.yml
, which holds sensitive information, such as database credentials and other secrets. -
uncommitted/data_docs
, which contains Data Docs generated from Expectations, Validation Results, and other metadata. -
uncommitted/validations
, which holds Validation Results generated by Great Expectations.
-
🚀🚀 Congratulations! 🚀🚀
You have initialized a new Data Context!3. Next steps​
Now that you have initialized a Data Context, you are ready to configure it to suit your needs.
For guidance on configuring database credentials, see:
For guidance on configuring Data Docs, see:
- How to host and share Data Docs on a filesystem
- How to host and share Data Docs on Azure Blob Storage
- How to host and share Data Docs on GCS
- How to host and share Data Docs on Amazon S3
For guidance on configuring Expectation Stores, see:
- How to configure an Expectation store to use Amazon S3
- How to configure an Expectation store to use Azure Blob Storage
- How to configure an Expectation store to use GCS
- How to configure an Expectation store to use a filesystem
- How to configure an Expectation store to use PostgreSQL
For guidance on configuring Validation Stores, see:
- How to configure a Validation Result store in Amazon S3
- How to configure a Validation Result store in Azure Blob Storage
- How to configure a Validation Result store in GCS
- How to configure a Validation Result store on a filesystem
- How to configure a Validation Result store to PostgreSQL
For guidance on configuring Metric Stores, see: