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

generate_model_yaml + windows #37

Closed
jakub-auger opened this issue Mar 24, 2021 · 7 comments
Closed

generate_model_yaml + windows #37

jakub-auger opened this issue Mar 24, 2021 · 7 comments

Comments

@jakub-auger
Copy link

jakub-auger commented Mar 24, 2021

the generate_model_yaml command example doesn't work on windows

DBT>dbt run-operation generate_model_yaml --args '{"model_name": "customers"}'
usage: dbt [-h] [--version] [-r RECORD_TIMING_INFO] [-d]
           [--log-format {text,json,default}] [--no-write-json]
           [--use-colors | --no-use-colors] [-S] [--warn-error]
           [--partial-parse | --no-partial-parse]
           {docs,source,init,clean,debug,deps,list,ls,snapshot,rpc,run,compile,parse,test,seed,run-operation}
           ...
dbt: error: unrecognized arguments: customers}'

windows cmd doesn't like the space, but the usual trick of wrapping it in quotes gives this error

DBT>dbt run-operation generate_model_yaml --args "'{"model_name": "customers"}'"
Running with dbt=0.19.0

Encountered an error while running operation: Compilation Error
  The --vars argument must be a YAML dictionary, but was of type 'str'

is there a way to get this working on windows?

@jaypeedevlin
Copy link
Contributor

I know this is months later, but I would try removing the space before "customers" to see if that fixes it

@scottcrowe
Copy link

scottcrowe commented Jun 10, 2021

I'm seeing the same thing as @jakub-auger on version 0.19.1 of dbt and 0.3.2 of dbt-codegen using the standard Windows cmd. The base example of dbt run-operation generate_model_yaml --args '{"model_name": "customers"}' works in Powershell and bash prompts running on Windows.

dbt run-operation generate_model_yaml --args '{"model_name":"customers"}' gives:

Encountered an error while running operation: Compilation Error
  The --vars argument must be a YAML dictionary, but was of type 'str'

Changing around the single and double quotes (i.e. dbt run-operation generate_model_yaml --args "{'model_name': 'customers'}" works in the basic command prompt.

So two work arounds for Windows users:

  • Use Powershell instead of default cmd
  • Swap Single and Double Quotes around

@pkanter
Copy link

pkanter commented May 20, 2022

So two work arounds for Windows users:

  • Use Powershell instead of default cmd
  • Swap Single and Double Quotes around

Super helpful, thank you.

@dharitsura248
Copy link

I believe @jakub-auger you can close this bug.

@jakub-auger
Copy link
Author

ok :)

@PhilimonNag
Copy link

PhilimonNag commented Jun 15, 2023

dbt run-operation generate_model_yaml --args '{"model_names": ["customers"]}'

you can try this.it can generate if you have customers.sql file

@tma-ngochieutran
Copy link

In window, I think you should run with the command:
dbt run-operation generate_model_yaml --args "{\"model_names\": [\"customers\"]}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants