Can we create a view which refers to a view which is not exist at that point of time?

53 views Asked by At

We have a view definition which internally uses other 5 views. When we use a RoundhousE to execute the database scripts, these view scripts are getting executed in alphabetical order. Hence out of these 5 views, which are used inside the main view, only 3 views are getting executed ahead of the main view and rest 2 views are not yet created and hence the main view script throws error. How can we solve this apart from renaming the views?

1

There are 1 answers

2
ferventcoder On

Either in the wiki, or in the source docs, I believe we cover this exact scenario. If not, we should add it there.

The solution when you have a dependency on order is to rename the files (not the views). Typically you would put the file names in order based on "0000_" (e.g. 0001_viewname.sql, 0002_viewname.sql, etc) at the front of the view name, but you could also just move the name of the main view to "z_" to place it after the other views.

I know you asked how you can solve this apart from renaming the view files, but renaming the files is how you resolve this issue.