schemachange icon indicating copy to clipboard operation
schemachange copied to clipboard

Status of Failed does not appear on change history table

Open mhan92 opened this issue 2 years ago • 2 comments

I have deployed a CI/CD process with snowflake using Schemachange.

So far it has been running as expected and we are increasing the number of users on the platform. The current iteration does not have the capabilities of loading FAILED scripts into the change history table, and the change history table does not update. I've had to manually insert a record with the all the values to avoid the process failing.

Is there an option I have missed for this?

I would like to submit a pull request for this to add into the schemachange for review if possible. Also add some enhancements that might be helpful.

Thanks, Michael Han

mhan92 avatar Sep 14 '22 15:09 mhan92

https://github.com/mhan92/schemachange/blob/master/schemachange/cli.py

To be honest, not to familiar with out contributions/forks/pull request work when it's not a repo I don't have access too but the above link is an attempt at a fix.

The updates include a try and except catch when the SQL compilation does not work. The process will write into the change_history table with Status as "Failed". Now someone can re-submit they're script after fixing typos or what not without changing the version number. The process will pickup the script and update the change history table with Status as Success and the Installed On timestamp.

I do believe adding a try and except clause will help keep auditing the change_history table a little bit easier. this will also ease up developers when submitting slight typos or weird grant issues that might arise. This update will also put the error on the description field of the failed executed script.

mhan92 avatar Sep 19 '22 20:09 mhan92

Hello @mhan92,

Thank you for reaching out and attempting to solve for failed scripts logging. What are your current thoughts of logging failed scripts based on the latest v3.6.0. Do you still think the try ... except is the way to log failed scripts?

Does your changes allow the script to be rerun even if the failure is in the middle of the list ?

Let us know your thoughts to help us decide to include failed scripts or not.

sfc-gh-tmathew avatar Sep 26 '23 04:09 sfc-gh-tmathew