Closed b-per closed 2 years ago
Hey @b-per!
I'm going to list out any questions / feedback I have in a single comment here:
General questions, likely no changes needed:
When I type dbt r<tab>
or dbt t<tab>
, is there functionality built in to bring up all commands which start with the letter? I notice that it does make the list smaller, but the list it retrieves doesn't seem to match up totally with the letter I've typed:
I know this isn't in the tests, but when I do something like dbt build <tab>
or dbt run <tab>
, I get a weird autofill:
I think that I would expect nothing here if it isn't supposed to do anything.
Here's a checklist I made for everything else:
[x] dbt <TAB>
[x] dbt --<TAB>
[x] dbt ls --<TAB>
[x] dbt run --<TAB>
[x] dbt test --<TAB>
[x] dbt build --<TAB>
[x] dbt docs --<TAB>
[x] dbt docs <TAB>
--- These possibly hold up merging this - The below aren't working for me. Here's a loom
[ ] dbt xxx --select source:<TAB>
[ ] dbt xxx --select tag:<TAB>
[ ] dbt xxx --select metrics:<TAB>
[ ] dbt xxx --select exposures:<TAB>
[ ] dbt xxx --select config.materialized:view
[ ] dbt xxx --select state:modified
[ ] dbt xxx --selector <TAB>
[ ] dbt xxx --select fct_<TAB>
[ ] dbt xxx --select <package_name>.<TAB>
[ ]dbt run --models fct_<TAB>
[ ]dbt ls --select fct_<TAB>
[ ] dbt xxx --select <TAB> <TAB>
[ ] dbt xxx --select <TAB>,<TAB>
Thanks @christineberger for checking the PR!
For 1. , this is the default behaviour of ZSH completion. When you type dbt d
it is actually looking at all the dbt
commands that contain (and not start with) d
. I could check if it is possible to only get the ones starting with the letter but this behaviour has not changed since the creation of this script.
Trying to debug 2. made me find a bug (that will most likely also affect the bash version) so I pushed a change to call python3
instead of python
. I don't think that your issue was related to that.
2 questions:
dbt
installed via homebrew or via pip
? And if via pip
where you in a virtual environment where dbt
is installed when doing the tests?cat target/manifest.json
? The completion script reads this file but it doesn't generate it. If the file doesn't exist, could you do a dbt ls
to generate it and try again? I couldn't reproduce the dbt build \'metrics\'
error. Saying so, there is a known limitation when doing dbt run/test/build <TAB>
(see the Cons part in https://github.com/dbt-labs/dbt-completion.bash/pull/7). It will display the list of models even if it is not valid. Back when I created the original script I couldn't find a way to get around it.
Finding and selecting models seem to be all that's working on my end. See my checklist below. I'm using oh-my-zsh and have version 1.0.3 of dbt-snowflake installed via pip3.
[ ] dbt
[ ] dbt xxx --select source:
[ ] dbt xxx -e
[x] dbt xxx --select
Thanks for the troubleshooting @wasilaq !
For the record, the behaviour was due to the bash
completion being activated for zsh
. Removing source ~/.dbt-completion.bash
from .zshrc
properly activated the "true" zsh
completion
Changes to the ZSH completion to accommodate the following changes:
source:xxx
which was broken in latest versionsexposure:xxx
metric:xxx
config / state / result
select
andselector
completion for thels
command