database-tycoon 0.2.2__tar.gz → 0.2.4__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 (155) hide show
  1. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/CHANGELOG.md +84 -0
  2. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/PKG-INFO +1 -1
  3. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/pyproject.toml +14 -18
  4. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/__init__.py +1 -1
  5. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/db.py +73 -15
  6. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/history.py +4 -0
  7. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/init.py +3 -2
  8. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/register.py +3 -2
  9. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/run_all.py +9 -6
  10. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/status.py +17 -7
  11. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/transform.py +112 -29
  12. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/config.py +15 -10
  13. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/core/events.py +14 -0
  14. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/core/history.py +26 -28
  15. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/dbt_profiles.py +4 -2
  16. database_tycoon-0.2.4/src/tycoon/observability/__init__.py +85 -0
  17. database_tycoon-0.2.4/src/tycoon/observability/dbt_capture.py +454 -0
  18. database_tycoon-0.2.4/src/tycoon/observability/dlt_capture.py +415 -0
  19. database_tycoon-0.2.4/src/tycoon/observability/store.py +219 -0
  20. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/project.py +17 -0
  21. database_tycoon-0.2.4/src/tycoon/utils/sql_guard.py +87 -0
  22. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/dbt_manifest.py +63 -3
  23. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/loader.py +31 -6
  24. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/models.py +5 -1
  25. database_tycoon-0.2.4/src/tycoon_city/cli.py +154 -0
  26. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/demo/cli.py +20 -12
  27. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/demo/factory.py +2 -1
  28. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/blocks.py +6 -0
  29. database_tycoon-0.2.2/src/tycoon_city/web_dist/assets/index-CosJ8RPj.js → database_tycoon-0.2.4/src/tycoon_city/web_dist/assets/index-B0UUzpxe.js +214 -213
  30. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/web_dist/index.html +1 -1
  31. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/webserve.py +40 -14
  32. database_tycoon-0.2.2/src/tycoon/observability.py +0 -1092
  33. database_tycoon-0.2.2/src/tycoon_city/sim/town_v5_plan.py +0 -333
  34. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/.gitignore +0 -0
  35. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/LICENSE +0 -0
  36. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/README.md +0 -0
  37. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/THIRD-PARTY.md +0 -0
  38. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/__main__.py +0 -0
  39. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/cli.py +0 -0
  40. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/__init__.py +0 -0
  41. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/city.py +0 -0
  42. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/data.py +0 -0
  43. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/docs.py +0 -0
  44. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/doctor.py +0 -0
  45. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/explore.py +0 -0
  46. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/fivetran.py +0 -0
  47. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/notify.py +0 -0
  48. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/observability.py +0 -0
  49. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/profiles.py +0 -0
  50. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/run.py +0 -0
  51. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/schedule.py +0 -0
  52. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/semantics.py +0 -0
  53. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/setup.py +0 -0
  54. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/sources.py +0 -0
  55. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/start.py +0 -0
  56. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/stop.py +0 -0
  57. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/commands/sync_cmd.py +0 -0
  58. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/constants.py +0 -0
  59. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/core/__init__.py +0 -0
  60. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/core/metadata.py +0 -0
  61. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/__init__.py +0 -0
  62. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/catalog.py +0 -0
  63. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/ducklake_config.py +0 -0
  64. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/fivetran_client.py +0 -0
  65. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/fivetran_sync.py +0 -0
  66. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/mta_bus_speeds_pipeline.py +0 -0
  67. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/mta_pipeline.py +0 -0
  68. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/nyc_dot_pipeline.py +0 -0
  69. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/runner.py +0 -0
  70. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/source_installer.py +0 -0
  71. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/source_manager.py +0 -0
  72. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/ingestion/sources/__init__.py +0 -0
  73. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/layers.py +0 -0
  74. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/metadata_backends/__init__.py +0 -0
  75. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/metadata_backends/duckdb_file.py +0 -0
  76. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/notify.py +0 -0
  77. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/quack.py +0 -0
  78. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/__init__.py +0 -0
  79. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/dbt_generator.py +0 -0
  80. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/observability_dbt.py +0 -0
  81. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/osi_generator.py +0 -0
  82. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/rill_generator.py +0 -0
  83. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/schemas/osi-v0.1.1.schema.json +0 -0
  84. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/scaffolding/templates.py +0 -0
  85. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/schedule.py +0 -0
  86. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/sync.py +0 -0
  87. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/README +0 -0
  88. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/data/input/widgets.csv +0 -0
  89. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/dbt_project.yml +0 -0
  90. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/models/marts/fct_widget_summary.sql +0 -0
  91. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/models/marts/schema.yml +0 -0
  92. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/models/staging/schema.yml +0 -0
  93. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/models/staging/stg_widgets.sql +0 -0
  94. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/dbt_project/profiles.yml +0 -0
  95. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/csv-import/tycoon.yml +0 -0
  96. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/github-analytics/template.yml +0 -0
  97. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/github-analytics/tycoon.yml +0 -0
  98. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/nyc-transit/README +0 -0
  99. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/nyc-transit/tycoon.yml +0 -0
  100. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/weather-station/template.yml +0 -0
  101. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/templates/weather-station/tycoon.yml +0 -0
  102. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/utils/__init__.py +0 -0
  103. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/utils/console.py +0 -0
  104. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/utils/duckdb_utils.py +0 -0
  105. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/utils/process.py +0 -0
  106. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/venv.py +0 -0
  107. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon/yaml_merge.py +0 -0
  108. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/__init__.py +0 -0
  109. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/__init__.py +0 -0
  110. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/column_lineage.py +0 -0
  111. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/errors.py +0 -0
  112. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/osi.py +0 -0
  113. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/retention.py +0 -0
  114. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/run_history.py +0 -0
  115. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/sql_lineage.py +0 -0
  116. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/catalog/tycoon_project.py +0 -0
  117. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/demo/__init__.py +0 -0
  118. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/demo/project.py +0 -0
  119. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/demo/semantic.yml +0 -0
  120. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/__init__.py +0 -0
  121. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/achievements.py +0 -0
  122. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/build.py +0 -0
  123. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/city_json.py +0 -0
  124. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/cli.py +0 -0
  125. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/measured.py +0 -0
  126. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/export/run_json.py +0 -0
  127. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/pricing.py +0 -0
  128. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/__init__.py +0 -0
  129. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/build_replay.py +0 -0
  130. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/channels.py +0 -0
  131. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/city.py +0 -0
  132. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/contracts.py +0 -0
  133. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/generator.py +0 -0
  134. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/layout.py +0 -0
  135. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/logistics.py +0 -0
  136. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/road_junctions.py +0 -0
  137. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/schemas/request_schema.json +0 -0
  138. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/schemas/shipment_schema.json +0 -0
  139. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/signals.py +0 -0
  140. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/tiles.py +0 -0
  141. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_arterials.py +0 -0
  142. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_blocks.py +0 -0
  143. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_endings.py +0 -0
  144. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_frontage.py +0 -0
  145. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_hierarchy.py +0 -0
  146. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_network.py +0 -0
  147. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_plan.py +0 -0
  148. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_precincts.py +0 -0
  149. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_rows.py +0 -0
  150. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_streets.py +0 -0
  151. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_texture.py +0 -0
  152. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/sim/town_zoning.py +0 -0
  153. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/theme_data.py +0 -0
  154. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/themes/default/spritesheet.png +0 -0
  155. {database_tycoon-0.2.2 → database_tycoon-0.2.4}/src/tycoon_city/themes/default/theme.toml +0 -0
@@ -1,5 +1,89 @@
1
1
  All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ## [0.2.4] - 2026-11-07
6
+
7
+ ### Fixed
8
+
9
+ - **`tycoon data run-all` runs tycoon's own dbt, not whichever is first on `PATH`** ([#439][]). `data transform` already preferred the dbt installed next to the Python running tycoon; `run-all` looked it up on `PATH` instead. A global dbt Fusion on `PATH` rewrote the warehouse file in a storage format the project's dbt-duckdb could not read, and a `uv tool install` with no dbt on `PATH` ingested and then failed with "`dbt` not found on PATH". `run-all` now resolves dbt the same way `data transform` does.
10
+ - **`tycoon data run-all` records its dbt build in run history** ([#326][]). After `run-all`, `.tycoon/metadata.duckdb` had no `dbt_runs` or `dbt_nodes` rows, so a project that only used `run-all` showed no dbt history and the city had no build traffic or test signal for it. Its dbt step now records the build the same way `transform build` does.
11
+ - **`tycoon data status` shows when each dbt layer was last built** ([#390][]). The staging, intermediate and marts panels always said "last build never", even when `tycoon data history` listed successful builds of those models. Status looked models up by bare name, but the run ledger stores each node under its dbt `unique_id` (`model.<project>.<name>`), so nothing ever matched. It now matches on `unique_id`. The ledger also stores build start times as local wall-clock time and status read them as UTC, which would have made a build two hours old in New York show as "6h ago"; status now reads them in local time. Ledgers written by earlier versions need no migration: their builds show up on the next `data status`.
12
+ - **City labels no longer draw on top of each other** ([#385][]). District and civic chips were placed independently, so on a real catalog `main_semantic` and `main_intermediate` merged into one unreadable line and the library and firehouse chips stacked on one spot. A colliding chip now moves up or down by a chip height or two; larger districts keep their spot, and a civic chip that still has no room is hidden until the view changes.
13
+
14
+ - **`tycoon city` names the dbt sources a staging model reads, even when they live outside the warehouse** ([#387][]). When a project's sources point at a separate database (for example `database: raw`, an attached DuckDB file or a DuckLake), none of them is an object in the warehouse the city reads, so lineage stopped at staging and every staging model listed its upstream as "none". The export now lists those sources on each model under `objects[].dbt.external_upstream`, with dbt's freshness verdict when `sources.json` has one; a source read through an ephemeral model is listed on the model that uses it. The city still draws no building for them, because nothing about them can be measured from the warehouse.
15
+
16
+ - **`data history` no longer marks a successful dbt build as failed** ([#341][]). dbt 1.10 and later report exposures and saved queries as `no-op`, and tycoon counted every status outside a fixed list of good ones as an error, so a clean build that touched an exposure showed `✗`. tycoon now counts only dbt's failure statuses (`error`, `fail`, `runtime error`, `partial success`), so a status dbt adds later doesn't turn into a false failure. `dbt_runs.success` in `.tycoon/metadata.duckdb` was NULL on every row, because tycoon read a top-level `success` key that `run_results.json` doesn't have. It now comes from dbt's exit code, or from the node statuses when the exit code isn't known.
17
+ - **Failed dbt runs show up in `data history`** ([#377][]). A run that failed before dbt wrote `run_results.json`, such as an unknown target or a DuckDB file locked by another run, was never recorded, so the history only listed successes. `tycoon data transform` now records it as failed, and `data history show` gives dbt's exit code and a one-line error summary: the first failed node's message, or dbt's own error text when no node ran. dbt's output still prints as it runs; tycoon keeps its last lines for the summary. A run whose selector matched nothing, which dbt treats as a success, is now flagged with `!` and "nothing ran" instead of a green tick.
18
+ - **A `motherduck:` warehouse or raw target is no longer treated as a local file** ([#308][]). DuckDB and dbt-duckdb accept `motherduck:<name>` as well as `md:<name>`, but tycoon only recognised `md:`, so `database.warehouse: motherduck:x` resolved to `<root>/motherduck:x` and failed with "Database not found". One `is_motherduck()` helper in `tycoon.project` now decides, and `tycoon register`, `tycoon init`, dbt profile detection and secret redaction use it. Projects on `md:` or a local file behave as before; only strings that start with `motherduck:` change meaning. The city renderer and `tycoon data sync` follow in a later PR.
19
+
20
+ ### Changed
21
+
22
+ - **`tycoon data query` refuses writes on a MotherDuck database unless you pass `--allow-writes`** ([#309][]). DuckDB cannot open an `md:` database read-only, so `data query` ran whatever it was given with the permissions of your token: `tycoon data query "DROP TABLE ..."` ran against production. tycoon now classifies each statement with sqlglot and, on an `md:` warehouse or `--raw` database, runs only SELECT, WITH, `FROM tbl`-first queries, `TABLE tbl`, VALUES, set operations, DESCRIBE, SHOW, SUMMARIZE, PIVOT, UNPIVOT and EXPLAIN of those. Anything else exits 1 before connecting, with `Refusing to run DROP against MotherDuck (md:x). On MotherDuck, 'data query' only runs SELECT, WITH, FROM, TABLE, VALUES, DESCRIBE, SHOW, SUMMARIZE, PIVOT, UNPIVOT and EXPLAIN. Pass --allow-writes to run other statements.` Every statement in a multi-statement input is checked, and a statement sqlglot cannot parse, or a query nested too deeply to parse, is refused too. **This changes behaviour for MotherDuck users who wrote through `data query`: add `--allow-writes` to those commands and scripts.** The check reads statement types only. Function calls inside a SELECT are not inspected, so `SELECT nextval('s')`, `read_csv` on a path or URL, or `FROM checkpoint()` still run without the flag. It guards against accidents and is not a permission boundary; scope your token if that matters. Local DuckDB files already open read-only and are unaffected.
23
+ - **`tycoon data schema` estimates row counts on a MotherDuck database** ([#310][]). It ran an exact `count(*)` on every table, which is slow and spends compute on a large account. It now reads `estimated_size` from `duckdb_tables()` and prints each figure as `~1,000 rows (estimate)`. The estimate does not drop after deletes (100,000 rows less half of them still shows `~100,000`), so treat it as an upper bound on a table that has lost rows. A view has no catalog estimate and prints `view (use --exact to count)`; a table whose catalog reports none prints `no estimate (use --exact to count)`. Pass `--exact` to count every table and view as before. Local DuckDB files are unchanged and still show exact counts, with or without `--exact`.
24
+
25
+ [#308]: https://github.com/Database-Tycoon/tycoon-cli/issues/308
26
+ [#309]: https://github.com/Database-Tycoon/tycoon-cli/issues/309
27
+ [#310]: https://github.com/Database-Tycoon/tycoon-cli/issues/310
28
+ [#341]: https://github.com/Database-Tycoon/tycoon-cli/issues/341
29
+ [#377]: https://github.com/Database-Tycoon/tycoon-cli/issues/377
30
+ [#385]: https://github.com/Database-Tycoon/tycoon-cli/issues/385
31
+ [#387]: https://github.com/Database-Tycoon/tycoon-cli/issues/387
32
+ [#390]: https://github.com/Database-Tycoon/tycoon-cli/issues/390
33
+ [#439]: https://github.com/Database-Tycoon/tycoon-cli/issues/439
34
+ [#326]: https://github.com/Database-Tycoon/tycoon-cli/issues/326
35
+
36
+ ## [0.2.3] - 2026-10-24
37
+
38
+ _Headline: **documentation site and a tested city**. The documentation site now publishes to GitHub Pages whenever a release reaches `main`, with internal pages withheld by a check that fails the build rather than leaking them. The city renderer is tested and gated in CI like the CLI, and its vehicles, guests and refresh now work. Also here: `tycoon-city` help that matches every other command, and tycoon's agent skills as three Claude Code plugins._
39
+
40
+ ### Added
41
+
42
+ - **The documentation site is published** ([#348][], PR [#415][]). `mkdocs build --strict` already ran on every pull request, but the built site was discarded: GitHub Pages had never been enabled, `https://database-tycoon.github.io/tycoon-cli/` returned 404, and three places in the repository linked to that dead URL (`site_url` in `mkdocs.yml`, the `tycoon docs` module docstring, which calls it "the public docs", and `docs/reference/dependencies.md`, which calls it "the docs site you're reading right now"). A `docs.yml` workflow builds the site on every push to `main` and deploys it to Pages, so those three references resolve. Since `main` only advances when a release branch merges, the published site tracks the released version. Both the pull-request job and the deploy run `scripts/check_docs_publishable.py` after the build: it fails if a page `draft_docs` or `exclude_docs` withholds reached the build, or if a `nav` entry points at a page that was not built, which `mkdocs build --strict` reports only at INFO and would otherwise ship as a dead link on every page. `CONTRIBUTING.md` gains a Documentation section recording where the line between published and internal pages is drawn, and which of its two rules the docs job can enforce.
43
+ - **The docs site has a releases index and a regrouped navigation** (PRs [#416][], [#417][]). A releases page links the current release and the 0.2 series, the home page's Releases card points at it instead of the 0.1.5 notes, a Recipes card is added, the sidebar groups releases into 0.2.x and 0.1.x sections that fold away, and every page gets its own table of contents.
44
+ - **Agent skills install as Claude Code plugins** ([#307][], PRs [#374][], [#375][]). Three plugins ship from this repository's marketplace, each in its own plugin root under `plugins/`: `tycoon`, five skills for working in a tycoon project (adding data sources, diagnosing projects, reading pipeline state, building models and dashboards, operating pipelines), and `tycoon-contributors` and `tycoon-maintainers`, for working on tycoon itself. Install with `/plugin marketplace add Database-Tycoon/tycoon-cli`, then `/plugin install tycoon@tycoon-skills`. The skills are not part of the Python package. `tests/test_agent_skills.py` checks each plugin's manifest and skill list, frontmatter, install names and `CONTRIBUTING.md` citations, and fails on stale text such as `uvx ruff`.
45
+ - **A MotherDuck roadmap for contributors** ([#429][], PR [#432][]). `docs/proposals/motherduck-support.md` orders the local-to-MotherDuck work into four phases across 0.2.4 to 0.3.1. It is a contributor page and is not published.
46
+
47
+ ### Fixed
48
+
49
+ - **The city's traffic actually drives** (PR [#250][]). The animation loop ticked the vehicle and guest simulations but never called the layers' `update()`, the only writers of the instance matrices, so both meshes sat at count 0 over a fully simulated street. Listed as a known limitation in 0.2.0 and 0.2.1. The verification hooks counted the simulation arrays and hid it; they now answer from the drawn mesh.
50
+ - **`R` refresh repaints the document-derived chrome** (PR [#250][]). The footer status line, the degradation-notes popover and the legend were painted once at boot, so a refresh showed a fresh "exported N ago" over the previous city's name, counts, notes and legend.
51
+ - **Coverage renders unknown, not zero, when the evidence was never read** (PR [#251][]). The renderer's schema was missing the `achievements` block the exporter has emitted since 2026-08-06, so it was silently stripped and the problems gauges, library panel and library tour recomputed coverage from raw fields, reporting "columns documented 0%" for a catalog with no dbt manifest. All three now honour the unknown state.
52
+
53
+ ### Changed
54
+
55
+ - **The city renderer is CI-gated** (PRs [#248][], [#249][], [#256][], [#252][]). `tests/tycoon_city`, including the `city.json` contract golden, joins the default `pytest` run and `src/tycoon_city` counts toward coverage (floor re-baselined to 73). A new `web` job runs `tsc --noEmit`, the production build, a check that the shipped `web_dist/` is exactly the build of `web/`, and the Playwright suite. Through 0.2.1 the CLI was gated and the renderer was not.
56
+ - **`tycoon-city` renders its help like every other tycoon command** ([#282][], PR [#287][]). The renderer's own console script is now a Typer app with `serve` and `demo` subcommands, and `tycoon-city PATH` stays legal as shorthand for `serve`, so `tycoon-city demo --help` and `tycoon city --help` no longer look like two different tools. The argparse `python -m tycoon_city.webserve [demo]` path remains for Docker and CI; both surfaces share one implementation.
57
+ - **Internal pages are kept out of the docs build** ([#348][], PR [#421][]). `docs_dir` carries 29 city-renderer pages (handover notes, agent task contracts, design log) and 4 draft proposals alongside the PyPI publishing runbook, an OpenMetadata note and an install script. They were out of `nav`, but MkDocs still built them, served them at guessable URLs and indexed them for search, so hosting the site at any point would have published all of them. `draft_docs` keeps the 33 city and proposal pages out of the build while `tycoon docs serve` still renders them locally, and `exclude_docs` drops the other three in both modes. The build carries no internal entries in its search index. Four links that pointed into the withheld directories now point at the repository instead.
58
+ - **The observability module is a package** ([#380][], PR [#381][]). `src/tycoon/observability.py`, at 1,092 lines, is split into `src/tycoon/observability/` (`store.py`, `dlt_capture.py`, `dbt_capture.py`) with the public names re-exported, so imports and behaviour are unchanged. For contributors.
59
+
60
+
61
+ ### Removed
62
+
63
+ - **The retired v5 city planner and its tests** ([#281][], PR [#256][]). The ring planner replaced it in 0.2.1, and the city contract doc and design log now describe the ring planner instead (PR [#254][]). For contributors; nothing user-facing used it.
64
+ [#250]: https://github.com/Database-Tycoon/tycoon-cli/pull/250
65
+ [#251]: https://github.com/Database-Tycoon/tycoon-cli/pull/251
66
+ [#252]: https://github.com/Database-Tycoon/tycoon-cli/pull/252
67
+ [#256]: https://github.com/Database-Tycoon/tycoon-cli/pull/256
68
+ [#282]: https://github.com/Database-Tycoon/tycoon-cli/issues/282
69
+ [#348]: https://github.com/Database-Tycoon/tycoon-cli/issues/348
70
+ [#421]: https://github.com/Database-Tycoon/tycoon-cli/pull/421
71
+ [#417]: https://github.com/Database-Tycoon/tycoon-cli/pull/417
72
+ [#416]: https://github.com/Database-Tycoon/tycoon-cli/pull/416
73
+ [#415]: https://github.com/Database-Tycoon/tycoon-cli/pull/415
74
+ [#248]: https://github.com/Database-Tycoon/tycoon-cli/pull/248
75
+ [#249]: https://github.com/Database-Tycoon/tycoon-cli/pull/249
76
+ [#254]: https://github.com/Database-Tycoon/tycoon-cli/pull/254
77
+ [#281]: https://github.com/Database-Tycoon/tycoon-cli/issues/281
78
+ [#287]: https://github.com/Database-Tycoon/tycoon-cli/pull/287
79
+ [#307]: https://github.com/Database-Tycoon/tycoon-cli/issues/307
80
+ [#374]: https://github.com/Database-Tycoon/tycoon-cli/pull/374
81
+ [#375]: https://github.com/Database-Tycoon/tycoon-cli/pull/375
82
+ [#380]: https://github.com/Database-Tycoon/tycoon-cli/issues/380
83
+ [#381]: https://github.com/Database-Tycoon/tycoon-cli/pull/381
84
+ [#429]: https://github.com/Database-Tycoon/tycoon-cli/issues/429
85
+ [#432]: https://github.com/Database-Tycoon/tycoon-cli/pull/432
86
+
3
87
  ## [0.2.2] - 2026-10-09
4
88
 
5
89
  _Headline: **project-local environments**. Every tycoon project now gets its own uv-managed `.venv`, and a catalog source's code and dependencies live inside the project, so deleting `.venv` and running `uv sync` rebuilds the same environment. `--no-prompt` installs what it registers instead of skipping it, and `tycoon data sources migrate` moves an existing project over. Also here: a filesystem load that finds nothing no longer empties a table that already held rows, and a zero-row run is flagged instead of reading as a healthy sync._
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: database-tycoon
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Tycoon CLI — local-first analytics CLI that adapts to your existing data stack
5
5
  Project-URL: Homepage, https://github.com/Database-Tycoon/tycoon-cli
6
6
  Project-URL: Repository, https://github.com/Database-Tycoon/tycoon-cli
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
8
 
9
9
  [project]
10
10
  name = "database-tycoon"
11
- version = "0.2.2"
11
+ version = "0.2.4"
12
12
  description = "Tycoon CLI — local-first analytics CLI that adapts to your existing data stack"
13
13
  readme = "README.md"
14
14
  license = {text = "MIT"}
@@ -74,9 +74,11 @@ dev = [
74
74
  tycoon = "tycoon.cli:app"
75
75
  # The city addon's own entry points, carried over from pipeline-city. The
76
76
  # contract docs' quickstart and web/package.json's demo-data script invoke
77
- # tycoon-city-export; `tycoon city` wraps tycoon-city but the standalone
78
- # server stays invocable for renderer development without a project.
79
- tycoon-city = "tycoon_city.webserve:main"
77
+ # tycoon-city-export; `tycoon city` wraps the server but the standalone
78
+ # `tycoon-city` stays invocable for renderer development without a project.
79
+ # tycoon-city is a Typer app (tycoon_city.cli) so its --help renders like
80
+ # every other tycoon command; the argparse webserve.main stays for python -m.
81
+ tycoon-city = "tycoon_city.cli:app"
80
82
  tycoon-city-export = "tycoon_city.export.cli:main"
81
83
 
82
84
  [tool.hatch.build.targets.sdist]
@@ -106,13 +108,7 @@ markers = [
106
108
  "recipe: marker for recipe doctest blocks parsed from README / docs/recipes (`tests/test_recipe_doctests.py`). `mode=offline` blocks run by default; `mode=online` blocks gate on `--run-online`.",
107
109
  "subprocess_e2e: subprocess-driven end-to-end tests that shell out to the installed `tycoon` binary (catches PATH / Rich rendering / packaging bugs that in-process tests can't see). Included in the default run.",
108
110
  ]
109
- # tests/tycoon_city is the renderer's suite, carried over intact from the
110
- # pipeline-city repo before that repo is deleted. It is not collected yet: its
111
- # paths are anchored with `Path(__file__).parents[N]` against the old repo root,
112
- # so nesting it one level deeper here shifts every one of them. Carrying it
113
- # un-run beats losing it. Wiring it up is tracked separately; until then CI
114
- # gates the CLI, not the renderer.
115
- addopts = "-m 'not e2e' --ignore=tests/tycoon_city"
111
+ addopts = "-m 'not e2e'"
116
112
 
117
113
  [tool.ruff]
118
114
  line-length = 120
@@ -130,16 +126,16 @@ target-version = "py312"
130
126
  "tests/test_ingestion.py" = ["F821"]
131
127
 
132
128
  [tool.coverage.run]
133
- source = ["src/tycoon"]
129
+ source = ["src/tycoon", "src/tycoon_city"]
134
130
  branch = false
135
131
 
136
132
  [tool.coverage.report]
137
- # Floor re-baselined after dropping server/dagster/ask extras (v0.1.10).
138
- # Removing that largely-untested code lifted the real ratio from ~65%
139
- # to ~73%. Floor sits 5 points under baseline for routine-drift
140
- # headroom (same margin as the old 65/60 split); raise it 1-2 points
141
- # per release alongside genuine test additions.
142
- fail_under = 68
133
+ # Floor re-baselined for v0.2.0 when tests/tycoon_city (563 tests) and the
134
+ # src/tycoon_city package joined the gated run: combined baseline is ~78%.
135
+ # Floor sits 5 points under baseline for routine-drift headroom (same
136
+ # margin as previous cycles); raise it 1-2 points per release alongside
137
+ # genuine test additions.
138
+ fail_under = 73
143
139
  show_missing = true
144
140
  skip_covered = false
145
141
  exclude_lines = [
@@ -1,3 +1,3 @@
1
1
  """Database Tycoon — local-first analytics CLI for exploring any dataset."""
2
2
 
3
- __version__ = "0.2.2"
3
+ __version__ = "0.2.4"
@@ -12,6 +12,7 @@ from rich.table import Table
12
12
  from tycoon.config import config, display_target, redact_secrets
13
13
  from tycoon.utils.console import console, error, header, info, status_table, success, warn
14
14
  from tycoon.utils.duckdb_utils import db_file_size_mb, get_row_count, get_tables, quote_identifier
15
+ from tycoon.utils.sql_guard import refused_statement
15
16
 
16
17
 
17
18
  def _resolve_source_db(source_name: str) -> Path | None:
@@ -69,8 +70,24 @@ def _has_schema(db_path: Path, schema_name: str) -> bool:
69
70
  # ---------------------------------------------------------------------------
70
71
 
71
72
 
72
- def schema() -> None:
73
- """Show database tables, row counts, and file sizes."""
73
+ def schema(
74
+ exact: Annotated[
75
+ bool,
76
+ typer.Option(
77
+ "--exact",
78
+ help=(
79
+ "Count rows exactly on a MotherDuck database instead of reading the catalog's estimate, "
80
+ "which does not drop after deletes."
81
+ ),
82
+ ),
83
+ ] = False,
84
+ ) -> None:
85
+ """Show database tables, row counts, and file sizes.
86
+
87
+ On a MotherDuck database, row counts are estimates read from the catalog
88
+ unless --exact is passed; the estimate does not drop after deletes. Local
89
+ DuckDB files always show exact counts.
90
+ """
74
91
  header("Database Schema")
75
92
 
76
93
  rows: list[tuple[str, str, str]] = []
@@ -82,7 +99,7 @@ def schema() -> None:
82
99
  (local_db, "Warehouse", config.warehouse_target),
83
100
  ]:
84
101
  if db_path is None:
85
- rows.extend(_motherduck_schema_rows(target, label))
102
+ rows.extend(_motherduck_schema_rows(target, label, exact))
86
103
  continue
87
104
  size = db_file_size_mb(db_path)
88
105
  if size is not None:
@@ -127,26 +144,41 @@ def schema() -> None:
127
144
  console.print(status_table(rows, title="Database Schema"))
128
145
 
129
146
 
130
- def _motherduck_schema_rows(target: str, label: str) -> list[tuple[str, str, str]]:
147
+ def _motherduck_schema_rows(target: str, label: str, exact: bool = False) -> list[tuple[str, str, str]]:
131
148
  """Schema rows for a MotherDuck database, read over one connection."""
132
149
  try:
133
150
  con = duckdb.connect(target)
134
151
  try:
135
152
  # An md: connection attaches every database on the account, so
136
- # scope the listing to the one the target names.
153
+ # scope the listing to the one the target names. duckdb_tables()
154
+ # has no row for a view, and an attached catalog may report no
155
+ # estimate for a table, so the estimate can be NULL for either.
137
156
  tables = con.execute(
138
- "SELECT table_schema, table_name FROM information_schema.tables "
139
- "WHERE table_catalog = current_database() "
140
- "AND table_schema NOT IN ('information_schema', 'pg_catalog') "
141
- "ORDER BY table_schema, table_name"
157
+ "SELECT t.table_schema, t.table_name, t.table_type, d.estimated_size "
158
+ "FROM information_schema.tables t "
159
+ "LEFT JOIN duckdb_tables() d ON d.database_name = t.table_catalog "
160
+ "AND d.schema_name = t.table_schema AND d.table_name = t.table_name "
161
+ "WHERE t.table_catalog = current_database() "
162
+ "AND t.table_schema NOT IN ('information_schema', 'pg_catalog') "
163
+ "ORDER BY t.table_schema, t.table_name"
142
164
  ).fetchall()
143
165
  rows = [
144
166
  (f"{label} database", "OK", f"MotherDuck {display_target(target)}"),
145
167
  (" Tables", "", f"{len(tables)}"),
146
168
  ]
147
- for s, table in tables:
148
- count = con.execute(f"SELECT count(*) FROM {quote_identifier(s)}.{quote_identifier(table)}").fetchone()
149
- rows.append((f" {s}.{table}", "", f"{count[0]:,} rows" if count else "empty"))
169
+ for s, table, table_type, estimate in tables:
170
+ if exact:
171
+ count = con.execute(
172
+ f"SELECT count(*) FROM {quote_identifier(s)}.{quote_identifier(table)}"
173
+ ).fetchone()
174
+ detail = f"{count[0]:,} rows" if count else "empty"
175
+ elif table_type == "VIEW":
176
+ detail = "view (use --exact to count)"
177
+ elif estimate is None:
178
+ detail = "no estimate (use --exact to count)"
179
+ else:
180
+ detail = f"~{estimate:,} {'row' if estimate == 1 else 'rows'} (estimate)"
181
+ rows.append((f" {s}.{table}", "", detail))
150
182
  finally:
151
183
  con.close()
152
184
  except duckdb.Error as exc:
@@ -173,11 +205,27 @@ def query(
173
205
  Path | None,
174
206
  typer.Option("--db", help="Path to a DuckDB file to query directly."),
175
207
  ] = None,
208
+ allow_writes: Annotated[
209
+ bool,
210
+ typer.Option(
211
+ "--allow-writes",
212
+ help=(
213
+ "On MotherDuck, run statements other than read-only queries (SELECT, WITH, FROM, TABLE, VALUES, "
214
+ "DESCRIBE, SHOW, SUMMARIZE, PIVOT, UNPIVOT, EXPLAIN). Only statement types are checked, so a "
215
+ "function call inside a SELECT is not inspected: this guards against accidents and is not a "
216
+ "permission boundary."
217
+ ),
218
+ ),
219
+ ] = False,
176
220
  ) -> None:
177
221
  """Run a SQL query against the warehouse, raw, or a source database.
178
222
 
179
- Local DuckDB files open read-only. A MotherDuck database runs with the
180
- permissions of your MotherDuck token.
223
+ Local DuckDB files open read-only. A MotherDuck database cannot open
224
+ read-only, so tycoon refuses any statement that is not a read-only query
225
+ unless --allow-writes is passed; with it, the statement runs with the
226
+ permissions of your MotherDuck token. The check reads statement types
227
+ only: function calls inside a SELECT are not inspected, so it is a guard
228
+ against accidents and not a permission boundary.
181
229
  """
182
230
  is_warehouse = False
183
231
  db_path: Path | None
@@ -222,13 +270,23 @@ def query(
222
270
  elif db_path is None:
223
271
  label = f"{label} (MotherDuck)"
224
272
 
273
+ if db_path is None and not via_quack and not allow_writes:
274
+ refused = refused_statement(sql)
275
+ if refused is not None:
276
+ error(
277
+ f"Refusing to run {refused} against MotherDuck ({display_target(target)}). "
278
+ "On MotherDuck, 'data query' only runs SELECT, WITH, FROM, TABLE, VALUES, DESCRIBE, SHOW, "
279
+ "SUMMARIZE, PIVOT, UNPIVOT and EXPLAIN. Pass --allow-writes to run other statements."
280
+ )
281
+ raise typer.Exit(1)
282
+
225
283
  try:
226
284
  if via_quack:
227
285
  con = quack.connect(quack_token)
228
286
  elif db_path is None:
229
287
  # read_only=True is a local-file flag: an md: URL opens an
230
288
  # in-memory local database, which DuckDB refuses to start
231
- # read-only. Write protection comes from the token's scope.
289
+ # read-only, so the guard above stands in for it.
232
290
  con = duckdb.connect(target)
233
291
  else:
234
292
  con = duckdb.connect(target, read_only=True)
@@ -106,6 +106,8 @@ def _render_history_table(runs: list[RunSummary]) -> Table:
106
106
  detail = _fmt_duration(s.duration_seconds)
107
107
  if s.rows_total:
108
108
  detail += f" · {s.rows_total} models"
109
+ elif s.zero_rows:
110
+ detail += " · [yellow]nothing ran[/yellow]"
109
111
  else:
110
112
  ref = f"{s.source_id}/{_short(s.run_id)}"
111
113
  if not s.zero_rows:
@@ -250,6 +252,8 @@ def _show_run(id_prefix: str) -> None:
250
252
 
251
253
  if s.status != "success":
252
254
  status_str = "[red]failed[/red]"
255
+ elif s.zero_rows and is_dbt:
256
+ status_str = "[yellow]success, but nothing ran[/yellow]"
253
257
  elif s.zero_rows and s.rows_total:
254
258
  status_str = "[yellow]success, but a table got zero rows[/yellow]"
255
259
  elif s.zero_rows:
@@ -15,6 +15,7 @@ from tycoon.project import (
15
15
  StackConfig,
16
16
  TransformationTool,
17
17
  WarehouseType,
18
+ is_motherduck,
18
19
  migrate_project,
19
20
  )
20
21
  from tycoon.scaffolding.templates import (
@@ -336,7 +337,7 @@ def _normalize_warehouse_for_compare(value: str) -> str:
336
337
  ``md:*`` strings are returned verbatim; filesystem paths are resolved
337
338
  against CWD if relative and returned as absolute.
338
339
  """
339
- if value.startswith("md:"):
340
+ if is_motherduck(value):
340
341
  return value
341
342
  abs_path = Path(value).expanduser()
342
343
  if not abs_path.is_absolute():
@@ -403,7 +404,7 @@ def _run_wizard(target: Path, project_name: str) -> WizardResult:
403
404
  aligned = _maybe_align_warehouse(warehouse_path, Path(dbt_path))
404
405
  if aligned != warehouse_path:
405
406
  warehouse_path = aligned
406
- if aligned.startswith("md:"):
407
+ if is_motherduck(aligned):
407
408
  warehouse = WarehouseType.motherduck
408
409
  else:
409
410
  warehouse = WarehouseType.duckdb
@@ -19,6 +19,7 @@ from tycoon.project import (
19
19
  BITool,
20
20
  TransformationTool,
21
21
  WarehouseType,
22
+ is_motherduck,
22
23
  )
23
24
  from tycoon.utils.console import console, error, header, info, success, warn
24
25
 
@@ -360,7 +361,7 @@ def register_dbt(
360
361
  def _align_duckdb_warehouse(raw: dict, stack: dict, dbt_warehouse: str) -> None:
361
362
  """DuckDB / MotherDuck alignment (v0.1.1 + v0.1.2 behavior, unchanged)."""
362
363
  current_warehouse = raw.get("database", {}).get("warehouse", "")
363
- if current_warehouse.startswith("md:"):
364
+ if is_motherduck(current_warehouse):
364
365
  current_norm = current_warehouse
365
366
  else:
366
367
  abs_path = Path(current_warehouse).expanduser() if current_warehouse else Path()
@@ -380,7 +381,7 @@ def _align_duckdb_warehouse(raw: dict, stack: dict, dbt_warehouse: str) -> None:
380
381
  if raw["database"].get("raw", "") == current_warehouse:
381
382
  raw["database"]["raw"] = dbt_warehouse
382
383
  stack["warehouse"] = (
383
- WarehouseType.motherduck.value if dbt_warehouse.startswith("md:") else WarehouseType.duckdb.value
384
+ WarehouseType.motherduck.value if is_motherduck(dbt_warehouse) else WarehouseType.duckdb.value
384
385
  )
385
386
 
386
387
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import shutil
6
5
  import time
7
6
  from typing import Annotated
8
7
 
@@ -121,11 +120,13 @@ def run_all_cmd(
121
120
 
122
121
  # 2. Transform
123
122
  if not skip_transform:
124
- dbt = shutil.which("dbt")
125
- if not dbt:
126
- error("`dbt` not found on PATH. Is your virtual environment active?")
127
- _emit("error", "run-all failed: dbt not found on PATH", stage="transform")
128
- raise typer.Exit(1)
123
+ from tycoon.commands.transform import _capture_dbt_and_refresh_safe, _dbt_executable
124
+
125
+ try:
126
+ dbt = _dbt_executable()
127
+ except typer.Exit:
128
+ _emit("error", "run-all failed: dbt not found", stage="transform")
129
+ raise
129
130
 
130
131
  project_dir = cfg.dbt_project_dir
131
132
  if not project_dir.exists():
@@ -136,7 +137,9 @@ def run_all_cmd(
136
137
  console.rule("[bold cyan]dbt build")
137
138
  cmd = [dbt, "build", "--target", target, "--profiles-dir", str(project_dir)]
138
139
  console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
140
+ started_at = time.time()
139
141
  result = subprocess.run(cmd, cwd=project_dir)
142
+ _capture_dbt_and_refresh_safe("build", started_at=started_at)
140
143
  if result.returncode != 0:
141
144
  error(f"dbt build failed (exit {result.returncode}).")
142
145
  _emit("error", "run-all failed during dbt build", stage="transform", exit_code=str(result.returncode))
@@ -130,24 +130,34 @@ def _freshness_label(last_sync: datetime.datetime | None) -> tuple[str, str]:
130
130
  # -- Layer-build freshness ------------------------------------------------------
131
131
 
132
132
 
133
- def _query_layer_last_build(metadata_db: Path, model_names: list[str]) -> datetime.datetime | None:
134
- """Latest successful build start time across ``model_names``."""
133
+ def _query_layer_last_build(metadata_db: Path, unique_ids: list[str]) -> datetime.datetime | None:
134
+ """Latest successful build start time across the dbt nodes in ``unique_ids``.
135
+
136
+ ``dbt_nodes.node_name`` holds the dbt ``unique_id``
137
+ (``model.<project>.<name>``), not the bare model name.
138
+
139
+ ``capture_dbt`` writes a UTC-aware datetime into the naive
140
+ ``started_at`` TIMESTAMP column, which DuckDB stores as wall-clock time
141
+ in its session time zone. Casting back to TIMESTAMPTZ in the same
142
+ session time zone recovers the real instant; reading the naive value
143
+ as UTC would skew the age by the local UTC offset.
144
+ """
135
145
  import duckdb
136
146
 
137
- if not model_names or not metadata_db.exists():
147
+ if not unique_ids or not metadata_db.exists():
138
148
  return None
139
149
  try:
140
150
  with duckdb.connect(str(metadata_db), read_only=True) as con:
141
151
  row = con.execute(
142
- "SELECT MAX(r.started_at) "
152
+ "SELECT MAX(r.started_at)::TIMESTAMPTZ "
143
153
  "FROM dbt_runs r "
144
154
  "JOIN dbt_nodes n ON n.invocation_id = r.invocation_id "
145
155
  "WHERE n.status = 'success' AND list_contains(?, n.node_name)",
146
- [model_names],
156
+ [unique_ids],
147
157
  ).fetchone()
148
- return row[0] if row and row[0] else None
149
158
  except Exception:
150
159
  return None
160
+ return row[0] if row else None
151
161
 
152
162
 
153
163
  # -- Panel renderers -----------------------------------------------------------
@@ -331,7 +341,7 @@ def _render_layer_panel(
331
341
  info(empty_hint)
332
342
  return
333
343
 
334
- last_build = _query_layer_last_build(metadata_db, [m.name for m in listed])
344
+ last_build = _query_layer_last_build(metadata_db, [m.identifier.removeprefix("dbt:") for m in listed])
335
345
  fresh_label, fresh_style = _freshness_label(last_build)
336
346
 
337
347
  table = Table(show_header=True, header_style="bold cyan")