datasight 0.3.1__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. {datasight-0.3.1 → datasight-0.6.0}/PKG-INFO +24 -4
  2. {datasight-0.3.1 → datasight-0.6.0}/README.md +19 -3
  3. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/ask-in-web-ui.md +2 -2
  4. datasight-0.6.0/docs/end-user/how-to/connect-spark.md +480 -0
  5. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/explore-files.md +37 -10
  6. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/install.md +10 -0
  7. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/reference/web-ui.md +1 -1
  8. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/tutorials/getting-started.md +2 -2
  9. {datasight-0.3.1 → datasight-0.6.0}/docs/index.md +4 -4
  10. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/database-connections.md +46 -12
  11. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/querying-files.md +38 -2
  12. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/schema-description.md +33 -0
  13. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/set-up-project.md +8 -3
  14. {datasight-0.3.1 → datasight-0.6.0}/docs/reference/cli.md +18 -13
  15. {datasight-0.3.1 → datasight-0.6.0}/docs/reference/configuration.md +14 -2
  16. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/projects.ts +1 -1
  17. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ExploreCard.svelte +1 -1
  18. datasight-0.6.0/frontend/src/lib/components/ProjectHealth.svelte +267 -0
  19. {datasight-0.3.1 → datasight-0.6.0}/mkdocs.yml +2 -1
  20. {datasight-0.3.1 → datasight-0.6.0}/pyproject.toml +6 -1
  21. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/agent.py +57 -9
  22. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/cli.py +185 -77
  23. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/config.py +21 -1
  24. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/demo_dsgrid_tempo.py +20 -48
  25. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/explore.py +278 -12
  26. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/generate.py +5 -1
  27. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/llm.py +53 -2
  28. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/prompts.py +21 -0
  29. datasight-0.6.0/src/datasight/runner.py +1052 -0
  30. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/schema.py +63 -16
  31. datasight-0.6.0/src/datasight/schema_links.py +376 -0
  32. datasight-0.6.0/src/datasight/schema_types.py +23 -0
  33. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/settings.py +23 -2
  34. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/env.template +16 -1
  35. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/global_env.template +3 -0
  36. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/web/app.py +86 -20
  37. datasight-0.6.0/src/datasight/web/static/assets/index-DActroLe.js +366 -0
  38. datasight-0.6.0/src/datasight/web/static/assets/index-PCYPGrnK.css +1 -0
  39. datasight-0.3.1/src/datasight/web/static/assets/plotly.min-CzY2oMrX.js → datasight-0.6.0/src/datasight/web/static/assets/plotly.min-BSPLQj3h.js +1 -1
  40. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/web/templates/index.html +2 -2
  41. {datasight-0.3.1 → datasight-0.6.0}/tests/test_agent_extra.py +14 -0
  42. {datasight-0.3.1 → datasight-0.6.0}/tests/test_cli_tools.py +4 -2
  43. {datasight-0.3.1 → datasight-0.6.0}/tests/test_explore_extra.py +138 -0
  44. datasight-0.6.0/tests/test_explore_spark.py +184 -0
  45. {datasight-0.3.1 → datasight-0.6.0}/tests/test_generate.py +33 -0
  46. {datasight-0.3.1 → datasight-0.6.0}/tests/test_generate_persist_db.py +51 -0
  47. {datasight-0.3.1 → datasight-0.6.0}/tests/test_llm.py +106 -0
  48. datasight-0.6.0/tests/test_schema_links.py +346 -0
  49. datasight-0.6.0/tests/test_spark_runner.py +537 -0
  50. {datasight-0.3.1 → datasight-0.6.0}/tests/test_web_app_extra.py +30 -0
  51. {datasight-0.3.1 → datasight-0.6.0}/uv.lock +226 -2
  52. datasight-0.3.1/frontend/src/lib/components/ProjectHealth.svelte +0 -160
  53. datasight-0.3.1/src/datasight/runner.py +0 -548
  54. datasight-0.3.1/src/datasight/web/static/assets/index-BLWRdIfD.js +0 -366
  55. datasight-0.3.1/src/datasight/web/static/assets/index-Cq4zJr8M.css +0 -1
  56. {datasight-0.3.1 → datasight-0.6.0}/.github/dependabot.yml +0 -0
  57. {datasight-0.3.1 → datasight-0.6.0}/.github/workflows/ci.yml +0 -0
  58. {datasight-0.3.1 → datasight-0.6.0}/.github/workflows/codeql.yml +0 -0
  59. {datasight-0.3.1 → datasight-0.6.0}/.github/workflows/gh-pages.yml +0 -0
  60. {datasight-0.3.1 → datasight-0.6.0}/.github/workflows/release.yml +0 -0
  61. {datasight-0.3.1 → datasight-0.6.0}/.gitignore +0 -0
  62. {datasight-0.3.1 → datasight-0.6.0}/.pre-commit-config.yaml +0 -0
  63. {datasight-0.3.1 → datasight-0.6.0}/AGENTS.md +0 -0
  64. {datasight-0.3.1 → datasight-0.6.0}/CLAUDE.md +0 -0
  65. {datasight-0.3.1 → datasight-0.6.0}/DISCLAIMER.md +0 -0
  66. {datasight-0.3.1 → datasight-0.6.0}/LICENSE +0 -0
  67. {datasight-0.3.1 → datasight-0.6.0}/codecov.yml +0 -0
  68. {datasight-0.3.1 → datasight-0.6.0}/dashboard-filter-roadmap.md +0 -0
  69. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/datasight-icon.svg +0 -0
  70. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/01-landing.png +0 -0
  71. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/02-chat-view.png +0 -0
  72. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/03-sql-editor.png +0 -0
  73. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/04-chart-result.png +0 -0
  74. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/05-dashboard.png +0 -0
  75. {datasight-0.3.1 → datasight-0.6.0}/docs/assets/screenshots/06-web-ui-reference.png +0 -0
  76. {datasight-0.3.1 → datasight-0.6.0}/docs/concepts/choosing-an-llm.md +0 -0
  77. {datasight-0.3.1 → datasight-0.6.0}/docs/concepts/how-the-agent-works.md +0 -0
  78. {datasight-0.3.1 → datasight-0.6.0}/docs/concepts/sql-result-cache.md +0 -0
  79. {datasight-0.3.1 → datasight-0.6.0}/docs/concepts/users-and-roles.md +0 -0
  80. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/explanation/query-confidence.md +0 -0
  81. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/explanation/semantic-measures.md +0 -0
  82. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/explanation/trusting-ai-results.md +0 -0
  83. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/ask-from-cli.md +0 -0
  84. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/audit-data-quality.md +0 -0
  85. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/build-a-dashboard.md +0 -0
  86. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/configure-measures.md +0 -0
  87. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/connect-flight-sql.md +0 -0
  88. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/create-visualizations.md +0 -0
  89. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/declare-time-series.md +0 -0
  90. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/review-query-log.md +0 -0
  91. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/run-on-hpc.md +0 -0
  92. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/save-and-rerun.md +0 -0
  93. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/how-to/save-dashboard-template.md +0 -0
  94. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/reference/keyboard-shortcuts.md +0 -0
  95. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/reference/query-confidence-toggles.md +0 -0
  96. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/tutorials/tempo.md +0 -0
  97. {datasight-0.3.1 → datasight-0.6.0}/docs/end-user/tutorials/time-validation.md +0 -0
  98. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/example-queries.md +0 -0
  99. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/schema-config.md +0 -0
  100. {datasight-0.3.1 → datasight-0.6.0}/docs/project-developer/verification.md +0 -0
  101. {datasight-0.3.1 → datasight-0.6.0}/docs/stylesheets/extra.css +0 -0
  102. {datasight-0.3.1 → datasight-0.6.0}/docs/tool-developer/architecture.md +0 -0
  103. {datasight-0.3.1 → datasight-0.6.0}/docs/tool-developer/contributing.md +0 -0
  104. {datasight-0.3.1 → datasight-0.6.0}/frontend/e2e/screenshots.spec.ts +0 -0
  105. {datasight-0.3.1 → datasight-0.6.0}/frontend/e2e/smoke.spec.ts +0 -0
  106. {datasight-0.3.1 → datasight-0.6.0}/frontend/index.html +0 -0
  107. {datasight-0.3.1 → datasight-0.6.0}/frontend/package-lock.json +0 -0
  108. {datasight-0.3.1 → datasight-0.6.0}/frontend/package.json +0 -0
  109. {datasight-0.3.1 → datasight-0.6.0}/frontend/playwright.config.ts +0 -0
  110. {datasight-0.3.1 → datasight-0.6.0}/frontend/public/datasight-icon.svg +0 -0
  111. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/App.svelte +0 -0
  112. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/app.css +0 -0
  113. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/assets/datasight-icon.svg +0 -0
  114. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/chat.ts +0 -0
  115. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/client.ts +0 -0
  116. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/dashboard.ts +0 -0
  117. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/measures.ts +0 -0
  118. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/saved.ts +0 -0
  119. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/schema.ts +0 -0
  120. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/settings.ts +0 -0
  121. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/sql.ts +0 -0
  122. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/starters.ts +0 -0
  123. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/api/summarize.ts +0 -0
  124. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/AddFilesInput.svelte +0 -0
  125. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/BookmarksList.svelte +0 -0
  126. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ChartResult.svelte +0 -0
  127. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ChatInput.svelte +0 -0
  128. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ChatView.svelte +0 -0
  129. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ClarifyOptions.svelte +0 -0
  130. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/CodeEditor.svelte +0 -0
  131. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/CommandPalette.svelte +0 -0
  132. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ConversationsList.svelte +0 -0
  133. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardCard.svelte +0 -0
  134. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardGrid.svelte +0 -0
  135. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardNote.svelte +0 -0
  136. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardSection.svelte +0 -0
  137. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardToolbar.svelte +0 -0
  138. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DashboardView.svelte +0 -0
  139. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/DiscoveredFilesCard.svelte +0 -0
  140. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ExportBar.svelte +0 -0
  141. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/Header.svelte +0 -0
  142. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/LandingPage.svelte +0 -0
  143. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/LlmConfigForm.svelte +0 -0
  144. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/MeasureEditor.svelte +0 -0
  145. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/MeasureEditorModal.svelte +0 -0
  146. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/MessageBubble.svelte +0 -0
  147. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/MessageList.svelte +0 -0
  148. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/PlotlyChart.svelte +0 -0
  149. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ProjectCard.svelte +0 -0
  150. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ProjectsPanel.svelte +0 -0
  151. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/QueriesList.svelte +0 -0
  152. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/QueryHistoryPanel.svelte +0 -0
  153. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/RecipesList.svelte +0 -0
  154. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ReportsList.svelte +0 -0
  155. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/RunDetails.svelte +0 -0
  156. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SaveProjectModal.svelte +0 -0
  157. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SchemaInspector.svelte +0 -0
  158. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SettingsPanel.svelte +0 -0
  159. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ShortcutsModal.svelte +0 -0
  160. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/Sidebar.svelte +0 -0
  161. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SidebarSection.svelte +0 -0
  162. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SqlConfirmDialog.svelte +0 -0
  163. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SqlView.svelte +0 -0
  164. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/StarterGrid.svelte +0 -0
  165. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/StarterOverview.svelte +0 -0
  166. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/SuggestionButtons.svelte +0 -0
  167. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/TableResult.svelte +0 -0
  168. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/Toast.svelte +0 -0
  169. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/components/ToolIndicator.svelte +0 -0
  170. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/chat.svelte.ts +0 -0
  171. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/dashboard.svelte.ts +0 -0
  172. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/palette.svelte.ts +0 -0
  173. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/queries.svelte.ts +0 -0
  174. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/schema.svelte.ts +0 -0
  175. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/session.svelte.ts +0 -0
  176. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/settings.svelte.ts +0 -0
  177. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/sidebar.svelte.ts +0 -0
  178. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/sql_editor.svelte.ts +0 -0
  179. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/stores/toast.svelte.ts +0 -0
  180. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/types/plotly-js-dist-min.d.ts +0 -0
  181. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/types/plotly.ts +0 -0
  182. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/conversation.ts +0 -0
  183. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/emacs-keys.ts +0 -0
  184. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/format.ts +0 -0
  185. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/markdown.ts +0 -0
  186. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/search.ts +0 -0
  187. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/lib/utils/sql-completion.ts +0 -0
  188. {datasight-0.3.1 → datasight-0.6.0}/frontend/src/main.ts +0 -0
  189. {datasight-0.3.1 → datasight-0.6.0}/frontend/svelte.config.js +0 -0
  190. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/chat.test.ts +0 -0
  191. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/emacs-keys.test.ts +0 -0
  192. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/format.test.ts +0 -0
  193. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/search.test.ts +0 -0
  194. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/sql-completion.test.ts +0 -0
  195. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/stores.test.ts +0 -0
  196. {datasight-0.3.1 → datasight-0.6.0}/frontend/tests/summarize.test.ts +0 -0
  197. {datasight-0.3.1 → datasight-0.6.0}/frontend/tsconfig.json +0 -0
  198. {datasight-0.3.1 → datasight-0.6.0}/frontend/vite.config.ts +0 -0
  199. {datasight-0.3.1 → datasight-0.6.0}/frontend/vitest.config.ts +0 -0
  200. {datasight-0.3.1 → datasight-0.6.0}/scripts/build-frontend.sh +0 -0
  201. {datasight-0.3.1 → datasight-0.6.0}/scripts/generate_cli_reference.py +0 -0
  202. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/__init__.py +0 -0
  203. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/__main__.py +0 -0
  204. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/audit_report.py +0 -0
  205. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/chart.py +0 -0
  206. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/cost.py +0 -0
  207. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/dashboard_template.py +0 -0
  208. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/data_profile.py +0 -0
  209. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/demo.py +0 -0
  210. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/demo_time_validation.py +0 -0
  211. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/distribution.py +0 -0
  212. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/events.py +0 -0
  213. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/exceptions.py +0 -0
  214. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/export.py +0 -0
  215. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/identifiers.py +0 -0
  216. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/integrity.py +0 -0
  217. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/query_log.py +0 -0
  218. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/recent_projects.py +0 -0
  219. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/sql_validation.py +0 -0
  220. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/html/audit_report.mustache +0 -0
  221. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/html/chart.mustache +0 -0
  222. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/html/export_dashboard.mustache +0 -0
  223. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/html/export_session.mustache +0 -0
  224. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/queries.yaml +0 -0
  225. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/schema_description.md +0 -0
  226. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/time_series.yaml +0 -0
  227. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templates/validation.yaml +0 -0
  228. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/templating.py +0 -0
  229. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/validation.py +0 -0
  230. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/verify.py +0 -0
  231. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/web/__init__.py +0 -0
  232. {datasight-0.3.1 → datasight-0.6.0}/src/datasight/web/static/datasight-icon.svg +0 -0
  233. {datasight-0.3.1 → datasight-0.6.0}/tests/__init__.py +0 -0
  234. {datasight-0.3.1 → datasight-0.6.0}/tests/_env_helpers.py +0 -0
  235. {datasight-0.3.1 → datasight-0.6.0}/tests/conftest.py +0 -0
  236. {datasight-0.3.1 → datasight-0.6.0}/tests/test_agent.py +0 -0
  237. {datasight-0.3.1 → datasight-0.6.0}/tests/test_audit.py +0 -0
  238. {datasight-0.3.1 → datasight-0.6.0}/tests/test_audit_report_extra.py +0 -0
  239. {datasight-0.3.1 → datasight-0.6.0}/tests/test_caching_runner.py +0 -0
  240. {datasight-0.3.1 → datasight-0.6.0}/tests/test_cli_ask.py +0 -0
  241. {datasight-0.3.1 → datasight-0.6.0}/tests/test_cli_commands.py +0 -0
  242. {datasight-0.3.1 → datasight-0.6.0}/tests/test_cli_config.py +0 -0
  243. {datasight-0.3.1 → datasight-0.6.0}/tests/test_cli_tools_extra.py +0 -0
  244. {datasight-0.3.1 → datasight-0.6.0}/tests/test_config.py +0 -0
  245. {datasight-0.3.1 → datasight-0.6.0}/tests/test_config_extra.py +0 -0
  246. {datasight-0.3.1 → datasight-0.6.0}/tests/test_dashboard_template.py +0 -0
  247. {datasight-0.3.1 → datasight-0.6.0}/tests/test_data_profile_extra.py +0 -0
  248. {datasight-0.3.1 → datasight-0.6.0}/tests/test_distribution.py +0 -0
  249. {datasight-0.3.1 → datasight-0.6.0}/tests/test_docs_cli_reference.py +0 -0
  250. {datasight-0.3.1 → datasight-0.6.0}/tests/test_explore.py +0 -0
  251. {datasight-0.3.1 → datasight-0.6.0}/tests/test_export.py +0 -0
  252. {datasight-0.3.1 → datasight-0.6.0}/tests/test_export_extra.py +0 -0
  253. {datasight-0.3.1 → datasight-0.6.0}/tests/test_generate_extra.py +0 -0
  254. {datasight-0.3.1 → datasight-0.6.0}/tests/test_identifiers.py +0 -0
  255. {datasight-0.3.1 → datasight-0.6.0}/tests/test_integrity.py +0 -0
  256. {datasight-0.3.1 → datasight-0.6.0}/tests/test_prompts.py +0 -0
  257. {datasight-0.3.1 → datasight-0.6.0}/tests/test_query_log.py +0 -0
  258. {datasight-0.3.1 → datasight-0.6.0}/tests/test_recent_projects.py +0 -0
  259. {datasight-0.3.1 → datasight-0.6.0}/tests/test_reports.py +0 -0
  260. {datasight-0.3.1 → datasight-0.6.0}/tests/test_runner.py +0 -0
  261. {datasight-0.3.1 → datasight-0.6.0}/tests/test_runner_extra.py +0 -0
  262. {datasight-0.3.1 → datasight-0.6.0}/tests/test_schema.py +0 -0
  263. {datasight-0.3.1 → datasight-0.6.0}/tests/test_schema_config_load.py +0 -0
  264. {datasight-0.3.1 → datasight-0.6.0}/tests/test_schema_extra.py +0 -0
  265. {datasight-0.3.1 → datasight-0.6.0}/tests/test_schema_filter.py +0 -0
  266. {datasight-0.3.1 → datasight-0.6.0}/tests/test_settings.py +0 -0
  267. {datasight-0.3.1 → datasight-0.6.0}/tests/test_settings_extra.py +0 -0
  268. {datasight-0.3.1 → datasight-0.6.0}/tests/test_sql_validation.py +0 -0
  269. {datasight-0.3.1 → datasight-0.6.0}/tests/test_sql_validation_extra.py +0 -0
  270. {datasight-0.3.1 → datasight-0.6.0}/tests/test_time_series.py +0 -0
  271. {datasight-0.3.1 → datasight-0.6.0}/tests/test_validation.py +0 -0
  272. {datasight-0.3.1 → datasight-0.6.0}/tests/test_verify.py +0 -0
  273. {datasight-0.3.1 → datasight-0.6.0}/tests/test_web_app.py +0 -0
  274. {datasight-0.3.1 → datasight-0.6.0}/tests/test_web_ui_smoke.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasight
3
- Version: 0.3.1
3
+ Version: 0.6.0
4
4
  Summary: AI-powered data exploration with natural language
5
5
  Project-URL: Repository, https://github.com/dsgrid/datasight
6
6
  Project-URL: Documentation, https://dsgrid.github.io/datasight/
@@ -15,8 +15,10 @@ Requires-Dist: chevron<1,>=0.14
15
15
  Requires-Dist: click<9,>=8.0
16
16
  Requires-Dist: duckdb<2,>=1.0
17
17
  Requires-Dist: fastapi<1,>=0.110
18
+ Requires-Dist: httpx<1,>=0.27
18
19
  Requires-Dist: loguru<1,>=0.7
19
20
  Requires-Dist: openai<3,>=2
21
+ Requires-Dist: openpyxl<4,>=3.1
20
22
  Requires-Dist: pandas<4,>=2.0
21
23
  Requires-Dist: plotly<6,>=5.0
22
24
  Requires-Dist: psycopg[binary]<4,>=3.1
@@ -38,6 +40,8 @@ Requires-Dist: ty>=0.0.26; extra == 'dev'
38
40
  Requires-Dist: zensical>=0.0.31; extra == 'dev'
39
41
  Provides-Extra: export
40
42
  Requires-Dist: kaleido<1,>=0.2; extra == 'export'
43
+ Provides-Extra: spark
44
+ Requires-Dist: pyspark[connect]<5,>=4.0; extra == 'spark'
41
45
  Description-Content-Type: text/markdown
42
46
 
43
47
  # datasight
@@ -54,8 +58,9 @@ where you can ask questions in natural language. The agent writes SQL, runs
54
58
  queries, and generates interactive Plotly visualizations.
55
59
 
56
60
  Supports **DuckDB**, **PostgreSQL**, **SQLite**, and **Flight SQL** databases.
57
- Supports **Anthropic Claude** (default), **GitHub Models** (open source),
58
- and **Ollama** (local) as LLM backends.
61
+ Also queries local **CSV**, **Parquet**, and **Excel** (.xlsx) files directly —
62
+ no database setup required. Supports **Anthropic Claude** (default),
63
+ **GitHub Models** (open source), and **Ollama** (local) as LLM backends.
59
64
 
60
65
  ## Quick start
61
66
 
@@ -76,6 +81,20 @@ datasight run
76
81
 
77
82
  Open http://localhost:8084 and start asking questions.
78
83
 
84
+ ### Explore CSV, Parquet, or Excel files with no setup
85
+
86
+ ```bash
87
+ # Launch the web UI with no project, then paste a file or directory path
88
+ # into "Explore Files" to create views automatically
89
+ datasight run
90
+
91
+ # Or inspect a file from the command line (schema, row count, column stats)
92
+ datasight inspect generation.parquet
93
+
94
+ # Or build a persistent project from CSV/Parquet inputs
95
+ datasight generate generation.csv plants.csv --db-path grid.duckdb
96
+ ```
97
+
79
98
  Or ask from the command line without starting a server:
80
99
 
81
100
  ```bash
@@ -91,6 +110,7 @@ datasight ask --file questions.txt --output-dir batch-output
91
110
  - **Natural language queries** — ask questions in English, get SQL + results
92
111
  - **Interactive charts** — Plotly visualizations with chart-type switching
93
112
  - **Multiple databases** — DuckDB, PostgreSQL, SQLite, and Flight SQL
113
+ - **Query files directly** — point at a local CSV, Parquet, or Excel file (or directory) and start asking questions; datasight creates DuckDB views (or one table per Excel sheet) on the fly
94
114
  - **Headless CLI** — `datasight ask` runs queries without a web server
95
115
  - **Deterministic CLI workflows** — profile, quality, dimension, trend, and recipe commands that do not require an LLM
96
116
  - **Schema browser** — sidebar with tables, columns, and example queries
@@ -112,7 +132,7 @@ frontend built with Vite. It supports multiple LLM backends — Anthropic
112
132
  ```
113
133
  datasight run / datasight ask / datasight profile / datasight quality
114
134
  → LLM provider (Anthropic / OpenAI / GitHub Models / Ollama)
115
- → DuckDB / PostgreSQL / SQLite / Flight SQL
135
+ → DuckDB / PostgreSQL / SQLite / Flight SQL (or CSV/Parquet via DuckDB views)
116
136
  → Plotly chart generator
117
137
  → Web UI (SSE streaming) or CLI output
118
138
  ```
@@ -12,8 +12,9 @@ where you can ask questions in natural language. The agent writes SQL, runs
12
12
  queries, and generates interactive Plotly visualizations.
13
13
 
14
14
  Supports **DuckDB**, **PostgreSQL**, **SQLite**, and **Flight SQL** databases.
15
- Supports **Anthropic Claude** (default), **GitHub Models** (open source),
16
- and **Ollama** (local) as LLM backends.
15
+ Also queries local **CSV**, **Parquet**, and **Excel** (.xlsx) files directly —
16
+ no database setup required. Supports **Anthropic Claude** (default),
17
+ **GitHub Models** (open source), and **Ollama** (local) as LLM backends.
17
18
 
18
19
  ## Quick start
19
20
 
@@ -34,6 +35,20 @@ datasight run
34
35
 
35
36
  Open http://localhost:8084 and start asking questions.
36
37
 
38
+ ### Explore CSV, Parquet, or Excel files with no setup
39
+
40
+ ```bash
41
+ # Launch the web UI with no project, then paste a file or directory path
42
+ # into "Explore Files" to create views automatically
43
+ datasight run
44
+
45
+ # Or inspect a file from the command line (schema, row count, column stats)
46
+ datasight inspect generation.parquet
47
+
48
+ # Or build a persistent project from CSV/Parquet inputs
49
+ datasight generate generation.csv plants.csv --db-path grid.duckdb
50
+ ```
51
+
37
52
  Or ask from the command line without starting a server:
38
53
 
39
54
  ```bash
@@ -49,6 +64,7 @@ datasight ask --file questions.txt --output-dir batch-output
49
64
  - **Natural language queries** — ask questions in English, get SQL + results
50
65
  - **Interactive charts** — Plotly visualizations with chart-type switching
51
66
  - **Multiple databases** — DuckDB, PostgreSQL, SQLite, and Flight SQL
67
+ - **Query files directly** — point at a local CSV, Parquet, or Excel file (or directory) and start asking questions; datasight creates DuckDB views (or one table per Excel sheet) on the fly
52
68
  - **Headless CLI** — `datasight ask` runs queries without a web server
53
69
  - **Deterministic CLI workflows** — profile, quality, dimension, trend, and recipe commands that do not require an LLM
54
70
  - **Schema browser** — sidebar with tables, columns, and example queries
@@ -70,7 +86,7 @@ frontend built with Vite. It supports multiple LLM backends — Anthropic
70
86
  ```
71
87
  datasight run / datasight ask / datasight profile / datasight quality
72
88
  → LLM provider (Anthropic / OpenAI / GitHub Models / Ollama)
73
- → DuckDB / PostgreSQL / SQLite / Flight SQL
89
+ → DuckDB / PostgreSQL / SQLite / Flight SQL (or CSV/Parquet via DuckDB views)
74
90
  → Plotly chart generator
75
91
  → Web UI (SSE streaming) or CLI output
76
92
  ```
@@ -14,8 +14,8 @@ From the landing page you have three entry points:
14
14
  - **Guided starter** — pick a workflow like *Profile this dataset* or *Audit
15
15
  nulls and outliers* before loading data. datasight runs the starter as
16
16
  soon as your data loads.
17
- - **Explore Files** — enter a path to a CSV, Parquet, or DuckDB file (or a
18
- directory of Parquet files) and click **Explore**.
17
+ - **Explore Files** — enter a path to a CSV, Parquet, Excel, or DuckDB file
18
+ (or a directory of CSV/Parquet/Excel files) and click **Explore**.
19
19
  - **Open Project** — click a recent project or enter a project directory
20
20
  path. A project directory must contain `schema_description.md`.
21
21
 
@@ -0,0 +1,480 @@
1
+ # Connect to an Apache Spark backend
2
+
3
+ This guide covers configuring datasight to talk to an Apache Spark cluster
4
+ over [Spark Connect](https://spark.apache.org/docs/latest/spark-connect-overview.html).
5
+ Use this when your data is too large to fit on a single machine — typically
6
+ multi-terabyte Parquet, Delta, or Iceberg tables managed by Spark.
7
+
8
+ ## When to use this
9
+
10
+ Reach for the Spark backend when:
11
+
12
+ - **Your data is on a Spark cluster.** Generation data partitioned across
13
+ years of `report_date`, plant-level fuel consumption at sub-hourly
14
+ resolution, or any other multi-TB table set that a single laptop cannot
15
+ scan.
16
+ - **Someone else runs the cluster.** A data platform team at your
17
+ organization already operates Spark with Spark Connect enabled — you just
18
+ need a URI and credentials.
19
+ - **You want aggregations, not row dumps.** datasight's agent is steered
20
+ (via the system prompt) to always aggregate, always filter on partition
21
+ columns, and never `SELECT *` on Spark tables. The results come back as
22
+ small summaries suitable for a chart, not multi-gigabyte exports.
23
+
24
+ If your data fits on one machine, prefer DuckDB — it will be much faster
25
+ for interactive exploration.
26
+
27
+ ## Overview
28
+
29
+ Spark Connect decouples the client from the cluster. datasight (the web UI
30
+ and LLM agent) runs on your laptop; the Spark driver and executors run on
31
+ your cluster. Your laptop never materializes more than a bounded slice of
32
+ any result.
33
+
34
+ ```mermaid
35
+ flowchart LR
36
+ subgraph laptop ["Your laptop"]
37
+ DS[datasight web UI<br>+ LLM agent]
38
+ end
39
+ subgraph cluster ["Spark cluster"]
40
+ SC[Spark Connect server]
41
+ DR[Spark driver<br>+ executors]
42
+ DATA["Parquet / Delta / Iceberg<br>multi-TB tables"]
43
+ SC --> DR --> DATA
44
+ end
45
+ DS <-->|"SQL over<br>gRPC + Arrow"| SC
46
+
47
+ style DS fill:#15a8a8,stroke:#023d60,color:#fff
48
+ style SC fill:#fe5d26,stroke:#c44a1e,color:#fff
49
+ style DR fill:#2e7ebb,stroke:#1a5c8a,color:#fff
50
+ style DATA fill:#8a7d55,stroke:#6b6040,color:#fff
51
+ style laptop fill:#1a8a8a,stroke:#15a8a8,color:#fff
52
+ style cluster fill:#c44a1e,stroke:#fe5d26,color:#fff
53
+ ```
54
+
55
+ Queries travel as Spark logical plans over gRPC. Results stream back as
56
+ Arrow record batches. datasight stops reading the stream once the
57
+ accumulated result exceeds `SPARK_MAX_RESULT_BYTES` (default 100 MiB) and
58
+ surfaces a truncation warning in the UI and to the LLM.
59
+
60
+ ## Prerequisites
61
+
62
+ - A Spark cluster running **Spark 3.5 or newer** with the Spark Connect
63
+ server enabled.
64
+ - The **Spark Connect URI** for that cluster — typically `sc://host:15002`.
65
+ Ask your data platform team if you don't know it.
66
+ - A **bearer token** if the cluster requires authentication.
67
+
68
+ !!! tip
69
+ If you're not sure whether Spark Connect is enabled, ask for the URI.
70
+ Clusters running Databricks, EMR, or self-managed Spark with the
71
+ `spark.api.mode=connect` config have a Connect endpoint.
72
+
73
+ ## Step 1: Install the Spark extra
74
+
75
+ The Spark Connect client isn't bundled by default because it pulls in
76
+ pyspark. Install the extra on your laptop:
77
+
78
+ ```bash
79
+ pip install 'datasight[spark]'
80
+ ```
81
+
82
+ This adds `pyspark[connect]>=4.0,<5` to your environment. No Java is
83
+ required — the Connect client is pure Python and talks to the cluster
84
+ over gRPC.
85
+
86
+ ## Step 2: Configure the connection
87
+
88
+ In your project's `.env`:
89
+
90
+ ```bash
91
+ # Use any LLM provider (see Getting Started for options)
92
+ ANTHROPIC_API_KEY=sk-ant-...
93
+
94
+ DB_MODE=spark
95
+ SPARK_REMOTE=sc://spark-connect.example.com:15002
96
+ SPARK_TOKEN=your_bearer_token # optional, only if the cluster requires auth
97
+ ```
98
+
99
+ ### Tuning the byte cap
100
+
101
+ datasight caps client-side result size to protect your laptop (and, if you
102
+ host the web UI for others, the web server) from OOMing when the agent
103
+ writes a query that returns too much data. The default is 100 MiB on the
104
+ wire, which inflates to roughly 250–500 MiB as a pandas DataFrame.
105
+
106
+ Raise or lower the cap to match your environment:
107
+
108
+ ```bash
109
+ # Default — safe for most laptops and small web deployments
110
+ SPARK_MAX_RESULT_BYTES=104857600 # 100 MiB
111
+
112
+ # Lower for memory-constrained environments
113
+ SPARK_MAX_RESULT_BYTES=26214400 # 25 MiB
114
+
115
+ # Higher if you trust the queries and have the RAM
116
+ SPARK_MAX_RESULT_BYTES=524288000 # 500 MiB
117
+ ```
118
+
119
+ When a result is truncated, the UI shows a banner and the LLM sees a
120
+ partial-result warning in its tool output — so the agent can say "showing
121
+ the first 2M rows; add aggregation for the full answer" instead of
122
+ silently misreporting truncated data.
123
+
124
+ ## Step 3: Describe the schema for multi-TB scale
125
+
126
+ datasight introspects tables automatically, but for Spark it deliberately
127
+ **skips row counts** — a naive `SELECT COUNT(*)` on a partitioned
128
+ multi-TB table kicks off a full-cluster job every time the project loads.
129
+
130
+ To help the agent write cheap queries, document your partition columns
131
+ explicitly in `schema_description.md`:
132
+
133
+ ```markdown
134
+ ## generation_fuel
135
+
136
+ Daily net generation and fuel consumption by plant, aggregated from the
137
+ EIA-923 hourly feed. Approximately 4 billion rows.
138
+
139
+ **Partition columns:** `report_date` (daily), `energy_source_code`.
140
+ Always include a `report_date` filter — e.g. `WHERE report_date >=
141
+ '2024-01-01'` — otherwise the query scans the full history.
142
+
143
+ **Columns:**
144
+ - `plant_id` (int) — EIA plant identifier
145
+ - `report_date` (date) — partition key
146
+ - `energy_source_code` (varchar) — partition key; 'NG', 'COL', 'NUC', 'WND', etc.
147
+ - `net_generation_mwh` (double) — MWh produced in the period
148
+ - `fuel_consumed_units` (double) — physical units of fuel consumed
149
+ - `fuel_consumed_mmbtu` (double) — heat content consumed
150
+ ```
151
+
152
+ Partition hints in the schema description flow into the system prompt, so
153
+ the agent learns to write `WHERE report_date >= '2024-01-01' AND
154
+ energy_source_code = 'NG'` instead of full-table scans.
155
+
156
+ ## Step 4: Run datasight
157
+
158
+ ```bash
159
+ datasight run
160
+ ```
161
+
162
+ datasight connects to the Spark Connect server via `spark.catalog.listTables()`,
163
+ pulls column metadata for each table, and starts the web UI at
164
+ <http://localhost:8084>. Ask a question and the agent writes Spark SQL
165
+ against your tables.
166
+
167
+ ### File-based commands also route through Spark
168
+
169
+ When `DB_MODE=spark` is set in your `.env`, commands that accept explicit
170
+ file arguments — `datasight inspect foo.parquet`, `datasight generate
171
+ --files`, `datasight trends --files`, and the web UI's "explore files"
172
+ flow — register the given Parquet/CSV paths as Spark temp views and run
173
+ introspection on the cluster instead of opening a local in-memory
174
+ DuckDB. Your `SPARK_REMOTE` appears in the startup log so you can
175
+ confirm Spark was used:
176
+
177
+ ```text
178
+ INFO File inspection routed through Spark Connect: sc://localhost:15002
179
+ INFO Connected to Spark Connect: sc://localhost:15002
180
+ INFO Spark session info: ...
181
+ ```
182
+
183
+ The file paths you pass must be reachable from the Spark workers at the
184
+ same absolute path — Spark does not upload local files to the cluster.
185
+ On HPC this is usually fine because `/scratch` / `/projects` are shared;
186
+ on a laptop-only Spark-Connect setup it won't work, so use DuckDB mode
187
+ in that case.
188
+
189
+ ### Verifying you're actually distributed
190
+
191
+ On startup, datasight logs the Spark session details it sees from the
192
+ Connect server. Look for a block like this in the terminal output:
193
+
194
+ ```text
195
+ INFO Spark session info:
196
+ version = 3.5.1
197
+ spark.master = spark://master-node:7077
198
+ spark.app.name = datasight
199
+ spark.app.id = app-20260422-0001
200
+ spark.default.parallelism = 208
201
+ spark.sql.shuffle.partitions = 200
202
+ spark.executor.instances = 2
203
+ spark.executor.cores = 104
204
+ spark.executor.memory = 200g
205
+ spark.dynamicAllocation.enabled = false
206
+ ```
207
+
208
+ The field to check first is **`spark.master`**:
209
+
210
+ - `spark://host:7077` — connected to a standalone cluster. ✓ distributed
211
+ - `yarn` / `k8s://...` — connected to a YARN / Kubernetes cluster. ✓
212
+ - `local` or `local[*]` — **the Connect server is running all work in
213
+ one JVM on the driver node.** No executors on other nodes are used.
214
+ This is almost always the reason only one node shows CPU activity.
215
+
216
+ If you see `local[*]` and you expected distribution, datasight also emits
217
+ a warning pointing at the fix:
218
+
219
+ ```text
220
+ WARNING Spark master is 'local[*]' — the Connect server is running all
221
+ work in one JVM on the driver node. If you expected distributed
222
+ execution, set spark.master on the Connect server (e.g.
223
+ spark://master:7077, yarn, or k8s://...) and restart it.
224
+ ```
225
+
226
+ `spark.master` is set on the **Connect server** side when it starts, not
227
+ on the datasight client. If you launched Spark with
228
+ `start-connect-server.sh --master local[104]`, that's where the setting
229
+ lives — restart the server with the correct master URL.
230
+
231
+ Also useful to check:
232
+
233
+ - `spark.executor.instances` — should be ≥ 1 for a real cluster. `None`
234
+ or missing means dynamic allocation, in which case look at
235
+ `spark.dynamicAllocation.minExecutors` / `maxExecutors`.
236
+ - `spark.default.parallelism` — roughly `executor_count × cores_per_executor`.
237
+ If this number looks like a single machine's core count, you're local.
238
+
239
+ ## Running Spark in the cloud
240
+
241
+ Most managed Spark services expose a Spark Connect endpoint — all
242
+ datasight needs is the `sc://…` URI and (if auth is enabled) a bearer
243
+ token.
244
+
245
+ **Databricks** — connection strings embed the PAT and target cluster
246
+ right in the URI. Datasight forwards this as-is:
247
+
248
+ ```bash
249
+ DB_MODE=spark
250
+ SPARK_REMOTE=sc://<workspace>.cloud.databricks.com:443/;token=<personal-access-token>;x-databricks-cluster-id=<cluster-id>
251
+ ```
252
+
253
+ **Self-managed on K8s / EKS / GKE / AKS / Dataproc / EMR** — you or
254
+ your team started a Spark Connect server on the cluster. The URI is
255
+ the service hostname and port, TLS if configured, plus optional token:
256
+
257
+ ```bash
258
+ DB_MODE=spark
259
+ SPARK_REMOTE=sc://spark-connect.example.com:15002
260
+ # Or with TLS + bearer auth:
261
+ # SPARK_REMOTE=sc://spark-connect.example.com:443/;use_ssl=true
262
+ SPARK_TOKEN=<bearer-token>
263
+ ```
264
+
265
+ No tunnel needed in either case — datasight connects directly to the
266
+ public endpoint. If your cluster is VPC-private, the usual options
267
+ apply: VPN, bastion tunnel, Cloud IAP, etc. — all of which terminate
268
+ at a local port that `SPARK_REMOTE=sc://localhost:<port>` points at.
269
+
270
+ ## Running Spark on an HPC compute node
271
+
272
+ If your organization doesn't have a shared Spark cluster but does have
273
+ HPC, you can start a short-lived Spark cluster on Slurm-allocated
274
+ compute nodes and tunnel to it from your laptop.
275
+
276
+ The cleanest path is **[sparkctl](https://github.com/NatLabRockies/sparkctl)**
277
+ — an NLR-developed tool that orchestrates a Spark standalone cluster
278
+ across Slurm-allocated compute nodes for you. It handles the master,
279
+ workers, and Connect server in a handful of commands. Fall back to the
280
+ hand-rolled single-node variant below only if sparkctl isn't available
281
+ on your cluster.
282
+
283
+ !!! important
284
+ **Do not run Spark on the login node.** Spark drivers and executors
285
+ can consume significant memory and CPU. Always allocate compute
286
+ nodes with Slurm first, then start the services on those nodes.
287
+
288
+ ### Recommended: sparkctl (multi-node standalone)
289
+
290
+ sparkctl stands up a Spark standalone cluster across the compute nodes
291
+ in your Slurm allocation — one head (master + driver) and N workers —
292
+ and starts the Connect server on the head node.
293
+
294
+ **Step 1: Install sparkctl** (one-time, on a login node)
295
+
296
+ ```bash
297
+ module load python
298
+ python -m venv ~/python-envs/sparkctl
299
+ source ~/python-envs/sparkctl/bin/activate
300
+ pip install sparkctl
301
+ ```
302
+
303
+ See the [sparkctl install guide](https://natlabrockies.github.io/sparkctl/)
304
+ for supported Spark versions and OS notes.
305
+
306
+ **Step 2: Allocate compute nodes**
307
+
308
+ sparkctl uses the Slurm env vars to discover the allocation. This
309
+ example reserves 1 node for the master + driver + your interactive
310
+ session, and 2 full nodes for workers:
311
+
312
+ ```bash
313
+ salloc -t 04:00:00 -n4 --partition=shared --mem=30G : \
314
+ -N2 --account=<your-account> --mem=240G
315
+ ```
316
+
317
+ **Step 3: Configure and start the cluster**
318
+
319
+ ```bash
320
+ source ~/python-envs/sparkctl/bin/activate
321
+ sparkctl configure # inspects the allocation, writes ./conf
322
+ sparkctl start # starts master, workers, and Connect server
323
+
324
+ # Set the env vars sparkctl prints so subsequent commands use this cluster.
325
+ export SPARK_CONF_DIR=$(pwd)/conf
326
+ export JAVA_HOME=<path printed by sparkctl>
327
+ ```
328
+
329
+ The Connect server binds to port 15002 on the head node (the box your
330
+ interactive session is on). Verify with `hostname` and pick that up as
331
+ `$HEAD_NODE` for the next step.
332
+
333
+ **Step 4: SSH tunnel from your laptop**
334
+
335
+ ```bash
336
+ ssh -N -L 15002:<head-node-hostname>:15002 user@hpc-login-node
337
+ ```
338
+
339
+ **Step 5: Configure datasight**
340
+
341
+ ```bash
342
+ DB_MODE=spark
343
+ SPARK_REMOTE=sc://localhost:15002
344
+ ```
345
+
346
+ **Step 6: When you're done**
347
+
348
+ ```bash
349
+ sparkctl stop
350
+ ```
351
+
352
+ Shutting down cleanly returns cluster resources to the scheduler and
353
+ avoids leaked JVMs.
354
+
355
+ See the [sparkctl Spark Connect tutorial](https://github.com/NatLabRockies/sparkctl/blob/main/docs/tutorials/run_python_spark_jobs_spark_connect.md)
356
+ for the full reference, including how to tune worker memory and
357
+ customize the Spark config before `sparkctl start`.
358
+
359
+ ### Fallback: hand-rolled single-node driver (local mode)
360
+
361
+ Use this only if sparkctl isn't installed on your cluster and you need
362
+ a quick smoke test. Everything runs in one JVM on one node, so there's
363
+ no cross-node parallelism — good for datasets that fit in a single
364
+ compute node's memory, bad for real multi-TB workloads.
365
+
366
+ ```mermaid
367
+ flowchart LR
368
+ subgraph laptop ["Your laptop"]
369
+ DS[datasight web UI<br>+ LLM agent]
370
+ end
371
+ subgraph login ["Login node"]
372
+ SSH[SSH tunnel<br>passthrough only]
373
+ end
374
+ subgraph compute ["Compute node · Slurm-allocated"]
375
+ SC[Spark Connect server]
376
+ DR[Spark driver<br>+ local executors]
377
+ PQ["/scratch parquet files"]
378
+ SC --> DR --> PQ
379
+ end
380
+ DS <-->|"SQL over<br>gRPC + Arrow"| SSH <-->|port 15002| SC
381
+
382
+ style DS fill:#15a8a8,stroke:#023d60,color:#fff
383
+ style SSH fill:#bf1363,stroke:#8a0d42,color:#fff
384
+ style SC fill:#fe5d26,stroke:#c44a1e,color:#fff
385
+ style DR fill:#2e7ebb,stroke:#1a5c8a,color:#fff
386
+ style PQ fill:#8a7d55,stroke:#6b6040,color:#fff
387
+ style laptop fill:#1a8a8a,stroke:#15a8a8,color:#fff
388
+ style login fill:#9e1050,stroke:#bf1363,color:#fff
389
+ style compute fill:#c44a1e,stroke:#fe5d26,color:#fff
390
+ ```
391
+
392
+ **Step A1: Allocate one compute node**
393
+
394
+ ```bash
395
+ salloc --time=4:00:00 --mem=240G --cpus-per-task=104 --account <your-account>
396
+ hostname # note the compute node hostname (e.g. compute-node-42)
397
+ ```
398
+
399
+ **Step A2: Start Spark Connect on the compute node**
400
+
401
+ Spark 3.5+ ships a helper script that launches a local driver with the
402
+ Connect server enabled:
403
+
404
+ ```bash
405
+ # On the compute node, inside your allocation
406
+ $SPARK_HOME/sbin/start-connect-server.sh \
407
+ --master "local[104]" \
408
+ --packages org.apache.spark:spark-connect_2.13:3.5.1 \
409
+ --conf spark.driver.memory=200g \
410
+ --conf spark.sql.execution.arrow.pyspark.enabled=true
411
+ ```
412
+
413
+ - `--master local[104]` runs driver and executors in one JVM using all
414
+ allocated cores (tune to `--cpus-per-task`).
415
+ - `--packages` pulls the Connect server jar matching your Spark version.
416
+ Some Spark distributions bundle it already — if so, omit this flag.
417
+ - `--conf spark.driver.memory=...` must fit inside your Slurm `--mem`
418
+ allocation with headroom for the Python gRPC process and OS cache.
419
+
420
+ The script binds the Connect gRPC server to `0.0.0.0:15002` by default.
421
+ Override with `--conf spark.connect.grpc.binding.port=<port>` if 15002
422
+ is taken. Check the driver log — it prints the exact bound address.
423
+
424
+ **Step A3: SSH tunnel from your laptop**
425
+
426
+ ```bash
427
+ ssh -N -L 15002:<compute-node-hostname>:15002 user@hpc-login-node
428
+ ```
429
+
430
+ Leave this running in a separate terminal.
431
+
432
+ **Step A4: Configure datasight**
433
+
434
+ ```bash
435
+ DB_MODE=spark
436
+ SPARK_REMOTE=sc://localhost:15002
437
+ # No SPARK_TOKEN needed — the SSH tunnel already authenticates you
438
+ ```
439
+
440
+ ### HPC gotchas
441
+
442
+ - **Use the compute node hostname in the `-L` target, not the login
443
+ node.** Spark is on the compute node; the login node is a passthrough.
444
+ If you tunnel only to the login node, you'll hit `connection refused`.
445
+ - **Watch for port collisions.** 15002 is the Spark Connect default;
446
+ if a previous job on the same node is still bound to it, startup
447
+ will fail. Either pick a different port (`spark.connect.grpc.binding.port`)
448
+ or kill the old job.
449
+ - **The tunnel dies when the allocation ends.** Request generous
450
+ `--time`, or use `salloc` so you can extend interactively.
451
+ - **Package resolution requires login-node internet.** The first
452
+ `--packages` invocation downloads jars to `~/.ivy2`. If your compute
453
+ nodes lack outbound network, pre-resolve on the login node first, or
454
+ install the Connect jar into `$SPARK_HOME/jars`.
455
+ - **Shared filesystem paths must match on every node** — workers
456
+ executing the query need the parquet data at the exact same path the
457
+ query references. sparkctl handles this for you; if you're hand-rolling,
458
+ prefer `/scratch` or `/projects` (identically mounted on every node)
459
+ over per-user paths.
460
+
461
+ ## Tips
462
+
463
+ - **Let the agent aggregate.** Questions like "total wind generation by
464
+ month in 2024" return a tiny result (12 rows) even though the underlying
465
+ table is terabytes. Questions like "show me every generation record in
466
+ 2024" will hit the byte cap — the agent will be told, and should
467
+ re-plan as an aggregation.
468
+ - **Document partition columns** explicitly in `schema_description.md`.
469
+ This is the single highest-leverage thing you can do to make Spark
470
+ queries fast.
471
+ - **Watch for truncation banners** in the UI. If they appear on
472
+ aggregated queries, your aggregation isn't grouping enough — the result
473
+ is still too wide. Either narrow the time range or bucket more
474
+ aggressively.
475
+ - **Server-side cancellation works.** If a query hits the `LLM_TIMEOUT`
476
+ or you kill the session, datasight calls Spark Connect's `interruptTag`
477
+ API so the cluster stops executing the job — cluster resources are
478
+ freed, not left running in the background.
479
+ - **Keep credentials out of git.** `.env` should be in `.gitignore`
480
+ (datasight adds it by default).