Skip to content
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

Update ShowTaskDirect to correctly handle --limit -1 #11284

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

WilliamDee
Copy link
Contributor

Problem

In dbt show, if we don't pass --limit it defaults to 5 and renders LIMIT 5 at the end of the SQL. You can get around it by adding --limit -1 so that it doesn't render the LIMIT. However, it seems like that only works for --inline and if you try doing dbt show --inline-direct <> --limit -1 it errors with an adapter error showing cannot limit by a negative row number for certain adapters. In the ShowRunner we handle this case by limit = None if self.config.args.limit < 0 else self.config.args.limit, but this isn't the case for ShowTaskDirect.

Solution

update ShowTaskDirect so that the limit gets set to None if it's a negative int when passed to the adapter.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@WilliamDee WilliamDee requested a review from a team as a code owner February 7, 2025 18:14
@cla-bot cla-bot bot added the cla:yes label Feb 7, 2025
@github-actions github-actions bot added the community This PR is from a community member label Feb 7, 2025
@WilliamDee WilliamDee requested a review from aranke February 7, 2025 18:15
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.89%. Comparing base (55e0df1) to head (0f51efe).
Report is 1 commits behind head on main.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11284      +/-   ##
==========================================
- Coverage   88.96%   88.89%   -0.07%     
==========================================
  Files         189      189              
  Lines       24138    24139       +1     
==========================================
- Hits        21474    21458      -16     
- Misses       2664     2681      +17     
Flag Coverage Δ
integration 86.15% <100.00%> (-0.15%) ⬇️
unit 62.56% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.56% <0.00%> (-0.01%) ⬇️
Integration Tests 86.15% <100.00%> (-0.15%) ⬇️

Copy link
Member

@aranke aranke left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@aranke aranke merged commit 7f32e42 into main Feb 10, 2025
60 of 61 checks passed
@aranke aranke deleted the will/fix-limit-inline-direct branch February 10, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes community This PR is from a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants