Snowflake-Labs / schemachange

A Database Change Management tool for Snowflake
Apache License 2.0
517 stars 228 forks source link

Alternate additional login option to --verbose, say --status, or --logging=STATUS|VERBOSE #209

Open SPSCS-Simon opened 1 year ago

SPSCS-Simon commented 1 year ago

Is your feature request related to a problem? Please describe. From a CI/CD perspective logging to track progress is helpful if one does not specify --verbose there is no logging of any progress, but --verbose is too noisy.

Describe the solution you'd like It would be good to have a --progress switch or a type of --logging with values of say STATUS|VERBOSE

Having elements of the --verbose logging with out all the details for --logging=STATUS/ --progress would be helpful:

Skipping change script V0.13.1.15__create_{file 1}.sql because it's older than the most recently applied change (0.13.1.15)
Applying change script V0.13.1.16__create_(file 2}.sql

Describe alternatives you've considered I don't believe there are any,

Additional context Without --verbose set an error produces a bunch of perceivably Python noise, like:

Max applied change script version: 1.2.5.0
  File "/opt/hostedtoolcache/Python/3.11.6/x64/bin/schemachange", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/schemachange/cli.py", line 888, in main
    deploy_command(config)
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/schemachange/cli.py", line 530, in deploy_command
    all_scripts = get_all_scripts_recursively(config['root_folder'], config['verbose'])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/schemachange/cli.py", line 746, in get_all_scripts_recursively
    raise ValueError(_err_dup_scripts_version.format(**script))
ValueError: {useful error message}
Error: Process completed with exit code 1.

It would also be good to suppress this, Python stack track like logging. It adds zero value!

SPSCS-Simon commented 1 year ago

I did not spot this issue - https://github.com/Snowflake-Labs/schemachange/issues/104 perhaps this can be appended to that.