Snowflake-Labs / schemachange

A Database Change Management tool for Snowflake
Apache License 2.0
481 stars 219 forks source link

feat: improve startup traceback if missing configuration #197

Open sfc-gh-twhite opened 9 months ago

sfc-gh-twhite commented 9 months ago

Currently, if you execute schemachange without a configuration file, it looks like this:

(venv) twhite@C02G43N2MD6R SnowSecure % schemachange
schemachange version: 3.6.0
Using root folder /Users/twhite/VSCodeProjects/SnowSecure
Using variables: {}
Traceback (most recent call last):
  File "/Users/twhite/VSCodeProjects/SnowSecure/venv/bin/schemachange", line 8, in <module>
    sys.exit(main())
  File "/Users/twhite/VSCodeProjects/SnowSecure/venv/lib/python3.10/site-packages/schemachange/cli.py", line 888, in main
    deploy_command(config)
  File "/Users/twhite/VSCodeProjects/SnowSecure/venv/lib/python3.10/site-packages/schemachange/cli.py", line 482, in deploy_command
    raise ValueError(_err_args_missing % ', '.join({s.replace('_', ' ') for s in missing_args}))
ValueError: Missing config values. The following config values are required: snowflake user, snowflake warehouse, snowflake role, snowflake account 

We should handle that more gracefully and provide more guidance to the end-user. This will help first-time users.

We could check for the file or configurations through environment variables, but the file check and error raise is likely the easier route.