'Is there an available script or tool to edit multiple JavaScript procedures at once?

I have a need to edit multiple JavaScript stored procedures at once. There is a common code change that needs to be made across 150+ SPs that are located across multiple logical DBs and schema in the Snowflake Account, and I am wondering what the fastest way would be to accomplish this instead of using a "CREATE OR REPLACE" one at a time?

Thanks.



Solution 1:[1]

The short lists of options are:

  • edit them with some regular expression editor externally, checking in the changes into your repository, and have your deployment tool redeploy them, as they have changed
  • edit them with some regular expression editor externally, checking in the changes into your repository, and then re-run the 150 CREATE OR REPLACE in a window. If you have them all manually setup
  • write a Snowflake Scripting block OR Stored Procedure to loop across them and rewrite then, then RECREATE them via the block
  • manually CREATE OR REPLACE them one by one by hand

You will find what ever leveling of the doing things correctly ladder mostly dictates your options. The last two a tied, as they are rather fiddling and painful to get right.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simeon Pilgrim