Skip to content

Add transactional DuckDB definitions and native PEG support - #405

Merged
nicosuave merged 3 commits into
mainfrom
duckdb-quality-peg
Oct 5, 2026
Merged

nicosuave merged 3 commits into
mainfrom
duckdb-quality-peg

Conversation

@nicosuave

@nicosuave nicosuave commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Make semantic definitions transactional and durable in DuckDB, with rollback, connection isolation, prepared execution, and migration from existing sidecars. Route definition imports through DuckDB's filesystem controls and preserve literal YAML values. Fix aliases and quoted-name routing, retain semantic errors, and reuse Rust parser workers without holding the registry lock during compilation.

Target DuckDB 1.5.6 for stable builds and add native PEG grammar for pinned 2.x. Rewrite semantic sources inside views, CREATE TABLE AS, and INSERT SELECT while preserving DuckDB's statement behavior, including parameters, RETURNING, EXPLAIN, and transactions. Views retain their compiled definition across restart and later metric changes.

Cover both versions in CI, including catalog lifecycle, parser coexistence, file permissions, SQL containers, and advanced metric execution. Retention uses structured compilation because its result is a table. Packaged shells that preload autocomplete require the SEMANTIC prefix because of DuckDB's parser ordering.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T22:31:08.323130Z a821fcc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a821fcc4fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +559 to +561
let cte_name = self.quote_identifier(&self.model_alias(model_name));
cte_defs.push(format!(
"{model_name}_cte AS (\n {cte_select}\n FROM {cte_source}{cte_where}\n)"
"{cte_name} AS (\n {cte_select}\n FROM {cte_source}{cte_where}\n)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Quote every reference to the newly quoted CTE aliases

When generating PostgreSQL or Redshift SQL for a model whose name contains uppercase characters, this now declares a case-sensitive CTE such as "Orders_cte", but derived/ratio metric expansion still emits unquoted references through simple_metric_reference_sql (for example, Orders_cte.revenue_raw). Those references are folded to lowercase and fail to resolve against the quoted CTE. Apply quote_identifier consistently to aliases in all metric-expansion and filter paths before changing the declaration to a quoted identifier.

Useful? React with 👍 / 👎.

@nicosuave
nicosuave merged commit 119a2bb into main Oct 5, 2026
31 checks passed
@nicosuave
nicosuave deleted the duckdb-quality-peg branch October 5, 2026 01:49
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.

1 participant