Title: Migrate client.sql() off deprecated v1 SQL-runner endpoints to the v2 query/sql flow · Issue #31 · lightdash/python-sdk · GitHub
Open Graph Title: Migrate client.sql() off deprecated v1 SQL-runner endpoints to the v2 query/sql flow · Issue #31 · lightdash/python-sdk
X Title: Migrate client.sql() off deprecated v1 SQL-runner endpoints to the v2 query/sql flow · Issue #31 · lightdash/python-sdk
Description: Problem client.sql() (the SQL Runner) calls Lightdash API endpoints that have been deprecated and are past their sunset date ("may be removed at any time"). If Lightdash removes them, client.sql() breaks. This is independent of query exe...
Open Graph Description: Problem client.sql() (the SQL Runner) calls Lightdash API endpoints that have been deprecated and are past their sunset date ("may be removed at any time"). If Lightdash removes them, client.sql() ...
X Description: Problem client.sql() (the SQL Runner) calls Lightdash API endpoints that have been deprecated and are past their sunset date ("may be removed at any time"). If Lightdash removes them, cli...
Opengraph URL: https://github.com/lightdash/python-sdk/issues/31
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Migrate client.sql() off deprecated v1 SQL-runner endpoints to the v2 query/sql flow","articleBody":"## Problem\n\n`client.sql()` (the SQL Runner) calls Lightdash API endpoints that have been **deprecated and are past their sunset date** (\"may be removed at any time\"). If Lightdash removes them, `client.sql()` breaks.\n\nThis is independent of query execution (`.execute()`), which already uses the current v2 async flow and is unaffected.\n\n## Deprecated endpoints in use\n\n`lightdash/sql_runner.py` currently calls:\n\n| SDK call | Lightdash status |\n|---|---|\n| `POST /api/v1/projects/{uuid}/sqlRunner/run` | `@deprecated` → `POST /api/v2/projects/{uuid}/query/sql` |\n| `GET /api/v1/projects/{uuid}/sqlRunner/results/{...}` | `@deprecated` → `GET /api/v2/projects/{uuid}/query/{queryUuid}/results` |\n| `GET /api/v1/schedulers/job/{jobId}/status` | (part of the old job-polling flow) |\n\nSource: [`packages/backend/src/controllers/sqlRunnerController.ts`](https://github.com/lightdash/lightdash/blob/main/packages/backend/src/controllers/sqlRunnerController.ts) — the `run` route is annotated `@deprecated Use POST /api/v2/projects/{projectUuid}/query/sql instead`, and the results route `@deprecated Use GET /api/v2/projects/{projectUuid}/query/{queryUuid}/results instead`. These are part of the batch deprecated **2025-02-17** with sunset **2025-05-17**.\n\nThe Lightdash **CLI has already migrated** to v2 (`packages/cli/src/handlers/sql.ts` → `/api/v2/projects/${projectUuid}/query/sql`), so the replacement path is proven.\n\n## Proposed solution\n\nMigrate `client.sql()` to the v2 async query flow:\n\n1. `POST /api/v2/projects/{uuid}/query/sql` with the SQL → returns a `queryUuid`\n2. Poll `GET /api/v2/projects/{uuid}/query/{queryUuid}` until ready, then page results\n\nThis mirrors the flow the SDK **already implements** for metric queries in `_QueryExecutor` (`query.py`) — submit → poll → paginate — so much of that logic can be reused/shared rather than written from scratch.\n\n## Open questions for the team\n\n- **Introspection endpoints:** `sqlRunner/tables` and `sqlRunner/fields` (used by `client.sql_runner.tables()/fields()`) do **not** appear to carry `@deprecated` markers. Leave them on v1, or migrate everything for consistency?\n- **Response shape:** does v2 `/query/sql` + `/query/{queryUuid}/results` return the same row/column shape `SqlResult` expects, or does the result transform need adjusting?\n- **Shared executor:** is it worth refactoring `_QueryExecutor` so both metric-query and SQL-query share the submit/poll/paginate machinery?\n- **Priority:** the sunset date has already passed — how urgent is this relative to other work?\n\n## Scope note\n\n`.execute()` / metric queries, `.compile()` (#5), explores metadata, and `/health` are all on **current, non-deprecated** endpoints — this issue is specifically the SQL Runner.\n","author":{"url":"https://github.com/jpetey75","@type":"Person","name":"jpetey75"},"datePublished":"2026-06-28T18:20:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/31/python-sdk/issues/31"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5f4e4e9d-a603-1a5e-2a43-9de23af96656 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC8E:384DDA:A88118:E74275:6A4D5121 |
| html-safe-nonce | 9cc2876890cd6305da24c8508ed926fdcd46f8aa405a942bd1262812095eb360 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzhFOjM4NEREQTpBODgxMTg6RTc0Mjc1OjZBNEQ1MTIxIiwidmlzaXRvcl9pZCI6Ijg5MzE2OTUzMDM0MTg3OTQyNzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ca873e9f7776041d38b21607494d73a46d4d157a7f9887f1d1e12d8efbff5382 |
| hovercard-subject-tag | issue:4763183481 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lightdash/python-sdk/31/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0b465d18f54f278f5058e3683ca2a99932aa9e8b3b0be2571365858bbdb4a349/lightdash/python-sdk/issues/31 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b465d18f54f278f5058e3683ca2a99932aa9e8b3b0be2571365858bbdb4a349/lightdash/python-sdk/issues/31 |
| og:image:alt | Problem client.sql() (the SQL Runner) calls Lightdash API endpoints that have been deprecated and are past their sunset date ("may be removed at any time"). If Lightdash removes them, client.sql() ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jpetey75 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/lightdash/python-sdk git https://github.com/lightdash/python-sdk.git |
| octolytics-dimension-user_id | 65912827 |
| octolytics-dimension-user_login | lightdash |
| octolytics-dimension-repository_id | 932695849 |
| octolytics-dimension-repository_nwo | lightdash/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 932695849 |
| octolytics-dimension-repository_network_root_nwo | lightdash/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width