Skip to content

Add datashare support to the template repo#61

Merged
jeff-dude merged 1 commit intomainfrom
miguel/dwh-443-dune-dbt-template-datashare
Apr 2, 2026
Merged

Add datashare support to the template repo#61
jeff-dude merged 1 commit intomainfrom
miguel/dwh-443-dune-dbt-template-datashare

Conversation

@msf
Copy link
Copy Markdown
Contributor

@msf msf commented Apr 2, 2026

Adds the validated datashare macro and post-hook to dune-dbt-template, plus an opt-in example model and repo-local setup guide. This keeps datashare support discoverable in the public template without syncing dev or PR schemas by default.

  • add the ALTER TABLE ... EXECUTE datashare(...) macro and wire it into dbt_project.yml
  • add one datashare-enabled example model plus monitoring and manual sync docs
  • restrict the automatic post-hook to prod so temporary schemas stay local

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 2, 2026

PR Summary

Medium Risk
Adds a new global post-hook that can execute ALTER TABLE ... EXECUTE datashare(...) on prod runs when models opt in via meta.datashare, which could impact production tables if misconfigured. Scope is otherwise contained to a new macro, docs, and a template model.

Overview
Adds opt-in Datashare synchronization support to the dbt template.

Introduces a new macro (datashare_trigger_sync() and datashare_trigger_sync_operation) that generates/executes ALTER TABLE ... EXECUTE datashare(...) for table and incremental models with meta.datashare.enabled: true, and wires it into dbt_project.yml as a global post-hook (guarded to only run on the prod target).

Adds a datashare-enabled incremental template model plus schema docs/tests, and updates README.md with a new Datashares section linking to the new docs/dune-datashares.md setup/monitoring/cleanup guide.

Written by Cursor Bugbot for commit 3e37243. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Inconsistent string coercion for full_refresh parameter
    • Added the same string coercion logic (full_refresh is string and full_refresh | lower in ['true', '1', 'yes', 'y']) to the is_full_refresh assignment on line 110, matching the existing pattern used for dry_run on line 128.

Create PR

Or push these changes by commenting:

@cursor push 327bd0c901
Preview (327bd0c901)
diff --git a/macros/dune_dbt_overrides/datashare_table_sync_post_hook.sql b/macros/dune_dbt_overrides/datashare_table_sync_post_hook.sql
--- a/macros/dune_dbt_overrides/datashare_table_sync_post_hook.sql
+++ b/macros/dune_dbt_overrides/datashare_table_sync_post_hook.sql
@@ -107,7 +107,7 @@
     {%- set node_config = node.config if node.config is mapping else {} -%}
     {%- set materialized = node_config.get('materialized', 'view') -%}
     {%- set table_name = node.alias if node.alias is not none else node.name -%}
-    {%- set is_full_refresh = materialized == 'table' or full_refresh is sameas true -%}
+    {%- set is_full_refresh = materialized == 'table' or full_refresh is sameas true or (full_refresh is string and full_refresh | lower in ['true', '1', 'yes', 'y']) -%}
 
     {%- set sql = _datashare_table_sync_sql(
         schema_name=node.schema,

You can send follow-ups to this agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

@msf msf force-pushed the miguel/dwh-443-dune-dbt-template-datashare branch from 3e37243 to a543fb4 Compare April 2, 2026 19:31
@jeff-dude jeff-dude merged commit 05cfe52 into main Apr 2, 2026
@jeff-dude jeff-dude deleted the miguel/dwh-443-dune-dbt-template-datashare branch April 2, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants