Skip to content

fix(duckdb): show all tables and views on schema refresh on Windows - #653

Merged
flakronademi merged 1 commit into
devfrom
fix/duckdb-schema-refresh-windows
Nov 19, 2026
Merged

flakronademi merged 1 commit into
devfrom
fix/duckdb-schema-refresh-windows

Conversation

@Edon-Ameti

@Edon-Ameti Edon-Ameti commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #614

Problem

On Windows, refreshing a DuckDB connection's schema tree in the SQL Editor sometimes dropped tables or views, and they came back on a later refresh.

Cause

DuckDBSchemaExtractor.extractSchema read the tables and the views at the same time with Promise.all, and each read opens the database file on its own. On Windows the second open fails while the first one still holds the file ("Cannot open file ... being used by another process"). The error was caught quietly, so that list came back empty. macOS and Linux don't lock the file this way, which is why it only happened on Windows.

Fix

Read the tables first, then the views, so only one open of the file exists at a time. No Windows-only code: every OS runs the same lines. On macOS and Linux the only difference is that the two reads no longer overlap.

Testing (Windows)

  • Script with 4 tables + 4 views, 20 refreshes each: before the fix 10 of 20 refreshes lost the views, after the fix 0 of 20.
  • Manual: refreshed the SQL Editor tree many times on a file with 7 tables, 7 views and a second schema. Every item showed every time.
  • tests/integration/connections/duckdb.extractor.test.ts: fails on dev ("selects a schema whose name needs quoting"), passes with the fix (6 of 6 runs).
  • Unit and integration suites run against the latest dev: no new failures. The remaining failures also fail on dev without this change. Locally that's Docker-dependent Postgres tests, line endings in git.service, a busy settings database file, and 30 known unit failures.
  • E2E: no UI changes, so no spec updates needed.

Not tested on macOS or Linux by hand; the integration workflow covers Linux.

Summary by CodeRabbit

  • Refactor
    • Schema extraction now retrieves table references and view references sequentially. The way tables and views are processed afterward remains unchanged.

…ws all of them on Windows

extractSchema opened the database file twice at once (tables and views via Promise.all). On Windows the second open fails on the file lock, so one list came back empty and items disappeared from the schema tree on refresh.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

extractSchema now reads DuckDB table references and view references sequentially instead of concurrently. Deduplication and subsequent table and view processing remain unchanged.

Changes: DuckDB schema extraction

Layer / File(s) Summary
Sequential table and view reads
src/connections/duckdb/duckdb.extractor.main.ts
extractSchema awaits table references before view references. Deduplication and subsequent processing remain unchanged.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: nuri1977, ailegion

Merge Risk: Minimal · up to 36826

DuckDB schema refresh now reads tables and views one after the other. This avoids the Windows file-open conflict that intermittently hid views. The change is small and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change (sequential schema reads for DuckDB) and the platform (Windows) and the symptom (missing tables and views on refresh). The raw summary describes sequential fetching in extra…
Linked Issues check Passed Issue #614 requires that all tables and views stay visible on every schema refresh for a DuckDB connection on Windows. At the reviewed head, DuckDBSchemaExtractor.extractSchema in `src/connections/d…
Out of Scope Changes check Passed The PR changes only the read ordering in extractSchema (about +6/-7 lines, per the summary). It also adds comments that explain the sequential reads. The change touches the code path that issue #614…
Full details: Title check

Explanation

The title names the change (sequential schema reads for DuckDB) and the platform (Windows) and the symptom (missing tables and views on refresh). The raw summary describes sequential fetching in extractSchema, which fits the title's fix. The title is specific and matches the linked issue #614 and the PR objectives. The title does not mention the sequential-read mechanism, but it covers the main outcome.

Full details: Linked Issues check

Explanation

Issue #614 requires that all tables and views stay visible on every schema refresh for a DuckDB connection on Windows. At the reviewed head, DuckDBSchemaExtractor.extractSchema in src/connections/duckdb/duckdb.extractor.main.ts awaits getTables() and then getViews() in sequence. Each executeQuery call opens and closes its own DuckDBInstance, so only one open of the database file exists at a time. getDetailedColumns also runs sequentially. This removes the overlapping file opens that the PR description identifies as the cause of the empty lists. The code no longer contains a Promise.all over these reads. The base revision could not be read in this checkout, so the removed concurrent form is established from the PR summary, not from a diff. The Windows test results in the PR description are author-reported and were not re-run. No new automated test was added by this PR. The existing integration test tests/integration/connections/duckdb.extractor.test.ts is cited as the regression check. The issue does not require a new test.

Full details: Out of Scope Changes check

Explanation

The PR changes only the read ordering in extractSchema (about +6/-7 lines, per the summary). It also adds comments that explain the sequential reads. The change touches the code path that issue #614 describes. No unrelated files or behaviors are changed according to the supplied summary. The base revision could not be read, so the full set of changed files is taken from the summary, not from a complete diff.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39c8783b-75ea-4da5-8329-0a8544f83764
Commits

Reviewing files that changed from the base of the PR and between 10b2778 and 368260c.

Files selected for processing: 1

  • src/connections/duckdb/duckdb.extractor.main.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@flakronademi
flakronademi self-requested a review November 18, 2026 11:51
@flakronademi
flakronademi merged commit 0734fdd into dev Nov 19, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Triage to Shipped in Rosetta dbt Studio Roadmap Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

DuckDB on Windows: tables and views disappear from the schema tree when I refresh

2 participants