Skip to content

Python API

SQLMesh is built in Python, and its complete Python API reference is located here.

The Python API reference is comprehensive and includes the internal components of SQLMesh. Those components are likely only of interest if you want to modify SQLMesh itself.

If you want to use SQLMesh via its Python API, the best approach is to study how the SQLMesh CLI calls it behind the scenes. The CLI implementation code shows exactly which Python methods are called for each CLI command and can be viewed on Github. For example, the Python code executed by the plan command is located here.

Almost all the relevant Python methods are in the SQLMesh Context class.