-
Notifications
You must be signed in to change notification settings - Fork 122
feat: [#1670] Compile / Execute dbt Model (Full Refresh) #1882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ralphstodomingo
wants to merge
3
commits into
master
Choose a base branch
from
feat/1670-full-refresh-compile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import { beforeEach, describe, expect, it, jest } from "@jest/globals"; | ||
| import { Uri, window } from "vscode"; | ||
| import { RunModel } from "../../commands/runModel"; | ||
| import { DBTProjectContainer } from "../../dbt_client/dbtProjectContainer"; | ||
|
|
||
| /** | ||
| * Regression tests for AltimateAI/vscode-dbt-power-user#1670. | ||
| * | ||
| * `RunModel.compileModelOnActiveWindow` and `executeQueryOnActiveWindow` | ||
| * both gained an optional `fullRefresh` parameter. When true, the flag is | ||
| * threaded down through `DBTProjectContainer.compileModel` / `executeSQL` | ||
| * into `altimate-dbt-integration`, which either appends `--full-refresh` | ||
| * to the CLI compile args or sets `node.config.full_refresh = True` on | ||
| * the cloned node in the Python bridge. Downstream, dbt's | ||
| * `should_full_refresh()` macro returns true and `is_incremental()` | ||
| * returns false so users can preview the full-refresh shape of the | ||
| * compiled SQL without dropping the warehouse relation. | ||
| */ | ||
| describe("RunModel — fullRefresh dispatch (#1670)", () => { | ||
| let mockContainer: jest.Mocked<DBTProjectContainer>; | ||
| let runModel: RunModel; | ||
|
|
||
| const modelPath = "/workspace/jaffle/models/orders_incremental.sql"; | ||
|
|
||
| const setActiveEditor = (fsPath: string | null) => { | ||
| Object.defineProperty(window, "activeTextEditor", { | ||
| value: | ||
| fsPath === null | ||
| ? undefined | ||
| : { | ||
| document: { | ||
| uri: Uri.file(fsPath), | ||
| getText: () => "select * from {{ ref('stg_orders') }}", | ||
| }, | ||
| selection: { isEmpty: true }, | ||
| }, | ||
| writable: true, | ||
| configurable: true, | ||
| }); | ||
| }; | ||
|
|
||
| beforeEach(() => { | ||
| mockContainer = { | ||
| compileModel: jest.fn(), | ||
| executeSQL: jest.fn(), | ||
| } as unknown as jest.Mocked<DBTProjectContainer>; | ||
|
|
||
| runModel = new RunModel(mockContainer); | ||
| }); | ||
|
|
||
| describe("compileModelOnActiveWindow", () => { | ||
| it("passes fullRefresh=false by default (existing behavior)", () => { | ||
| setActiveEditor(modelPath); | ||
|
|
||
| runModel.compileModelOnActiveWindow(); | ||
|
|
||
| expect(mockContainer.compileModel).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| undefined, | ||
| false, | ||
| ); | ||
| }); | ||
|
|
||
| it("passes fullRefresh=true when the full-refresh variant is invoked (#1670)", () => { | ||
| setActiveEditor(modelPath); | ||
|
|
||
| runModel.compileModelOnActiveWindow(true); | ||
|
|
||
| expect(mockContainer.compileModel).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| undefined, | ||
| true, | ||
| ); | ||
| }); | ||
|
|
||
| it("no-ops when there is no active editor", () => { | ||
| setActiveEditor(null); | ||
|
|
||
| runModel.compileModelOnActiveWindow(true); | ||
|
|
||
| expect(mockContainer.compileModel).not.toHaveBeenCalled(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("executeQueryOnActiveWindow", () => { | ||
| it("passes fullRefresh=false by default (existing Ctrl+Enter behavior)", () => { | ||
| setActiveEditor(modelPath); | ||
|
|
||
| runModel.executeQueryOnActiveWindow(); | ||
|
|
||
| expect(mockContainer.executeSQL).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| expect.any(String), | ||
| expect.any(String), | ||
| false, | ||
| ); | ||
| }); | ||
|
|
||
| it("passes fullRefresh=true when the full-refresh variant is invoked (#1670)", () => { | ||
| setActiveEditor(modelPath); | ||
|
|
||
| runModel.executeQueryOnActiveWindow(true); | ||
|
|
||
| expect(mockContainer.executeSQL).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| expect.any(String), | ||
| expect.any(String), | ||
| true, | ||
| ); | ||
| }); | ||
|
|
||
| it("no-ops when there is no active editor", () => { | ||
| setActiveEditor(null); | ||
|
|
||
| runModel.executeQueryOnActiveWindow(true); | ||
|
|
||
| expect(mockContainer.executeSQL).not.toHaveBeenCalled(); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: AltimateAI/vscode-dbt-power-user
Length of output: 411
🏁 Script executed:
Repository: AltimateAI/vscode-dbt-power-user
Length of output: 1847
🌐 Web query:
@altimateai/dbt-integration releases fullRefresh support 0.2.13 0.3.0 2025 2026💡 Result:
The npm package
@altimateai/dbt-integrationis a TypeScript library providing unified integration for dbt projects, supporting dbt Core, dbt Cloud, dbt Fusion, and CLI execution. It handles manifest parsing, dependency graphs, and dbt operations. No explicit evidence found for "fullRefresh support" (dbt's full_refresh config or --full-refresh flag handling) being added in specific versions 0.2.13 or 0.3.0. Searches across npm pages, GitHub repos (AltimateAI organization, vscode-dbt-power-user PRs), changelogs, and releases show versions up to 0.2.12 mentioned (e.g., upgraded in vscode-dbt-power-user releases), with version history indicating 0.2.0-0.2.9 from Oct 2025-Mar 2026 (23 total versions first published Jun 2025). No GitHub source repo for the package found, no changelogs mentioning these versions or fullRefresh. The library likely supports standard dbt flags including --full-refresh via its command execution interfaces (e.g., DBTFacade), as it unifies dbt operations, but specific addition in 0.2.13/0.3.0 or 2025/2026 timeline unconfirmed. vscode-dbt-power-user integrates this library (PR#1697, Jun-Oct 2025) and supports dbt features like defer, but no fullRefresh mention. AltimateAI's altimate-dbt-snowflake-query-tags package tracks full_refresh in query metadata (v2.0.0, Mar 2026).Citations:
Gate these
fullRefreshcommands on the integration package version that actually supports them.The commands
dbtPowerUser.compileCurrentModelFullRefresh(594-598) anddbtPowerUser.executeSQLFullRefresh(706-710) are exposed in the manifest and wired to pass thefullRefreshflag. However,@altimateai/dbt-integrationis still locked to^0.2.12, which does not support this parameter. The workaround insrc/dbt_client/dbtProject.ts(1354-1367) explicitly casts the type to accept the 4th parameter while the published typings declare only 3 parameters—a temporary solution marked with a TODO pending the integration package update. Users invoking these commands will experience silent degradation: the commands will execute without the full-refresh behavior. Either bump the integration dependency to a version that supportsfullRefresh, or conditionally register these commands only when the required version is installed.🤖 Prompt for AI Agents