> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cube.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a python report over dashboard-filtered SQL

Re-runs the Python analysis attached to one of this dashboard's reports over `sqlQuery` — the report's own query with the dashboard's filters and time grains already applied — and returns the result **without persisting it**.

Authorized against the dashboard, exactly as `GET /api/v1/embed/dashboard/{publicId}` is. The `reportVersionId` must be one of that dashboard's published report snapshots and must belong to `reportId`; anything else returns `403`. The Python itself is read server-side from that snapshot — it is never supplied by the caller.

The analysis runs under the calling embed user's own security context, so row-level security applies to the viewer, and the stored result other viewers see is left untouched. Results are cached briefly per (report, code, SQL, user); failures are not cached. Returns `403` when Python analysis is not enabled for the account.


## OpenAPI

````yaml /api-reference/api.yaml post /api/v1/embed/dashboard/{publicId}/python-run
openapi: 3.1.0
info:
  title: Cube Platform API
  version: 1.0.0
  description: >-
    Programmatically manage Cube: deployments and everything scoped to them

    (environments, folders, reports, workbooks, notifications, workspace, and
    agents),

    plus account-level users, groups, policies, embedding, and AI settings.
    Data-model

    authoring, dev mode, branches, and uploads live under /build/api/v1 — same
    host and

    token, routed to the build pods.
servers:
  - url: https://{tenant}.cubecloud.dev
    description: Your tenant host. Replace the whole host if you use a custom domain.
    variables:
      tenant:
        default: your-tenant
        description: Your Cube tenant subdomain
security:
  - bearerAuth: []
tags:
  - name: Deployments
  - name: Deployment Creation
  - name: Environments
  - name: Env Variables
  - name: Regions
  - name: Data Model
  - name: Data Model Uploads
  - name: GitHub
  - name: GitHub Connection
  - name: dbt Sync
  - name: Folders
  - name: Reports
  - name: Workbooks
  - name: Notifications
  - name: Workspace
  - name: Users Admin
  - name: User Attributes
  - name: User Attribute Values
  - name: Tenant Settings
  - name: OAuth Integrations
  - name: User OAuth Tokens
  - name: OIDC Token Configs
  - name: App Theme
  - name: Embed
  - name: Embed Tenants
  - name: Dashboard Embed Access
paths:
  /api/v1/embed/dashboard/{publicId}/python-run:
    post:
      tags:
        - Embed
      summary: Run a python report over dashboard-filtered SQL
      operationId: postDashboardPythonRun
      parameters:
        - in: path
          name: publicId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbedPythonFilteredRunInput'
        description: EmbedPythonFilteredRunInput
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PythonAnalysisFilteredRun'
          description: ''
components:
  schemas:
    EmbedPythonFilteredRunInput:
      properties:
        reportId:
          type: integer
        reportVersionId:
          type: integer
        sqlQuery:
          type: string
      required:
        - reportId
        - sqlQuery
        - reportVersionId
      type: object
    PythonAnalysisFilteredRun:
      properties:
        at:
          type: string
        executionError:
          oneOf:
            - type: string
            - type: 'null'
        inputRowCount:
          type: integer
        outputData:
          oneOf:
            - {}
            - type: 'null'
        stderr:
          type: string
        stdout:
          type: string
      required:
        - at
        - stdout
        - stderr
        - inputRowCount
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Token authentication. Send `Authorization: Bearer <YOUR_TOKEN>`.'

````