Data Contexts

Data Contexts manage connections to Great Expectations Datasets.

To get a data context, simply call get_data_context() on the ge object:

>> import great_expectations as ge
>> options = { ## my connection options }
>> sql_context = ge.get_data_context('sqlalchemy_context', options)

>> sql_dataset = sql_context.get_dataset('table_name')
There are currently two types of data contexts:
  • PandasCSVDataContext: The PandasCSVDataContext (‘PandasCSV’) exposes a local directory containing files as datasets.
  • SqlAlchemyDataContext: The SqlAlchemyDataContext (‘SqlAlchemy’) exposes tables from a SQL-compliant database as datasets.
All data contexts expose the following methods:
  • list_datasets(): lists datasets available in current context
  • get_dataset(dataset_name): returns a dataset with the matching name (e.g. filename or tablename)


The options paramater for a PandasCSVDataContext is simply the glob pattern matching the files to be available.


The options parameter for a SqlAlchemyDataContext is the sqlalchemy connection string to connect to the database.