data-mie / dbt-cloud-cli

dbt Cloud command line interface (CLI)
Apache License 2.0
71 stars 9 forks source link

Unable to create a job using dbt-cloud job create command in command-line #73

Closed YagnaSriramA closed 1 year ago

YagnaSriramA commented 1 year ago

I am trying to create a job. But it is throwing an error with the execute steps parameter. The following is my command - dbt-cloud job create --project-id 241666 --environment-id 188496 --name "NewJob" --execute-steps ["dbt run"]

Following is the error that it is throwing: Error: Invalid value for '--execute-steps': [dbt run]

I was initially trying to create a job using the dbt API by sending a post request which was also not working. The response shows that various parameter values in the request body are not valid. It would be great if someone could help me with the API problem as well. We are trying to automatically create jobs on the go based on a few parameters but manually doing that using API itself is not working.

stumelius commented 1 year ago

@YagnaSriramA You need to wrap the --execute-steps argument in quotes so it is parsed as a string:

dbt-cloud job create --project-id 241666 --environment-id 188496 --name "NewJob" --execute-steps '["dbt run"]'

Let me know if that works :)

YagnaSriramA commented 1 year ago

thank you for the reply @stumelius.

It did not work. It said -

1 validation error for DbtCloudJobCreateCommand execute_steps value is not a valid list (type=type_error.list)

stumelius commented 1 year ago

@YagnaSriramA I can't reproduce the error with

dbt-cloud job create --project-id 241666 --environment-id 188496 --name "NewJob" --execute-steps '["dbt run"]'

but with

dbt-cloud job create --project-id 241666 --environment-id 188496 --name "NewJob" --execute-steps '"dbt run"'

I can. Did you wrap the execute-steps list in quotes or did you strip away the list before wrapping the argument in quotes? i.e., use '["dbt run"]' instead of '"dbt run"'.

stumelius commented 1 year ago

Closing this after over 3 months of inactivity