Use this file to discover all available pages before exploring further.
The Lightdash Python SDK lets you query your semantic layer directly from Python. Use it in Jupyter notebooks, Python scripts, or anywhere you use Python to ensure everyone pulls from a single source of truth.
See it in action
Try the getting started Jupyter notebook for a hands-on walkthrough.
from lightdash import Clientclient = Client( instance_url="https://app.lightdash.cloud", access_token="your-token", project_uuid="your-uuid",)model = client.get_model("orders")# Build and execute a queryresult = ( model.query() .metrics(model.metrics.revenue, model.metrics.profit) .dimensions(model.dimensions.country) .filter(model.dimensions.status == "active") .sort(model.metrics.revenue.desc()) .limit(100) .execute())# Get results as a DataFramedf = result.to_df()# Or as a list of dictionariesrecords = result.to_records()