Data Modeling

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
GET
GET
GET
GET
GET
GET
GET

List all environments data modeling jobs

List data modeling jobs which are "runs" for our saved queries.

Required API key scopes

warehouse_view:read

Query parameters

  • cursor
    string
  • limit
    integer
  • saved_query_id
    string

Response


Example request

GET /api/environments/:environment_id/data_modeling_jobs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/data_modeling_jobs/

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}
]
}

Retrieve environments data modeling jobs

List data modeling jobs which are "runs" for our saved queries.

Required API key scopes

warehouse_view:read

Path parameters

  • id
    string

Response


Example request

GET /api/environments/:environment_id/data_modeling_jobs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/data_modeling_jobs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

Retrieve environments data modeling jobs recent

Get the most recent non-running job for each saved query from the v2 backend.

Response


Example request

GET /api/environments/:environment_id/data_modeling_jobs/recent
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/data_modeling_jobs/recent/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

Retrieve environments data modeling jobs running

Get all currently running jobs from the v2 backend.

Response


Example request

GET /api/environments/:environment_id/data_modeling_jobs/running
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/data_modeling_jobs/running/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

List all data modeling jobs

List data modeling jobs which are "runs" for our saved queries.

Required API key scopes

warehouse_view:read

Query parameters

  • cursor
    string
  • limit
    integer
  • saved_query_id
    string

Response


Example request

GET /api/projects/:project_id/data_modeling_jobs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_modeling_jobs/

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}
]
}

Retrieve data modeling jobs

List data modeling jobs which are "runs" for our saved queries.

Required API key scopes

warehouse_view:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/data_modeling_jobs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_modeling_jobs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

Retrieve data modeling jobs recent

Get the most recent non-running job for each saved query from the v2 backend.

Response


Example request

GET /api/projects/:project_id/data_modeling_jobs/recent
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_modeling_jobs/recent/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

Retrieve data modeling jobs running

Get all currently running jobs from the v2 backend.

Response


Example request

GET /api/projects/:project_id/data_modeling_jobs/running
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_modeling_jobs/running/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"saved_query_id": "841a020c-dad2-4bac-a071-aaf3f5af0641",
"status": "Cancelled",
"rows_materialized": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_run_at": "2019-08-24T14:15:22Z",
"workflow_id": "string",
"workflow_run_id": "string",
"rows_expected": 0
}

Community questions

Questions about this page? or post a community question.