Writing the VIEW and PROCEDURE bodies outside of the .yaml file #42
Replies: 2 comments 4 replies
-
Yes, this feature would be very helpful. And it is relatively easy to implement. However, the main questions from the design standpoint are: 1. Where SQL files should be placed? 2. Should we keep a placeholder in YAML? text: ${{ file:my_view.sql }} 3. Should we resolve placeholders in SQL files? 4. Should it be extended for UDF-functions in Python, Java, etc.? Let's think about the best approach a little. |
Beta Was this translation helpful? Give feedback.
-
@psequeirag , please check the latest update It should be possible to link external files via body: !include pr003_pr1(number).sql It is also possible to use sub-directories: body: !include python/pr003_pr1(number).py Paths are relative to parent directory of original YAML file. Absolute paths and wildcards are not allowed. Placeholders inside included files should be fully functional. Please let me know if it works for you. Thank you. |
Beta Was this translation helpful? Give feedback.
-
As we started to use SnowDDL, one of our teams complained that developing and maintaining VIEWS and STORED PROCEDURES in the .yaml files was cumbersome because they had to go back and forth between the Worksheet where they write and test the queries and statements, and then pasting and reformatting the final version in the .yaml file to be committed to the source code repository.
So, the idea came that maybe SnowDDL could support grabbing the text of the VIEW (and the body of the PROCEDURE), from a separate text file (say, named identically to the .yaml file of the view, but with the .sql extension). That way, it would no longer be necessary to re-format the text of the view query when copying it back and forth between the external file and the worksheets. SnowDDL would know to look for the external file if the text/body elements are missing in the .yaml.
What do you think? I was planning to start working on the implementation of this feature myself to see it in action, but wanted to check if you, too, think that this feature would be desirable and that the PR could be welcomed.
Beta Was this translation helpful? Give feedback.
All reactions