Update ShowTaskDirect to correctly handle --limit -1 #11284
Merged
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.
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 bylimit = None if self.config.args.limit < 0 else self.config.args.limit
, but this isn't the case forShowTaskDirect
.Solution
update
ShowTaskDirect
so that the limit gets set toNone
if it's a negative int when passed to the adapter.Checklist