As per best practices, is it advisable to have different files for all views or have them added to a single file?

HI,

Does it makes any difference if I have different files for all my views or have them consolidated in one single file?

1 4 1,276
4 REPLIES 4

Hello @gkatwal

I don’t think that having all the views in a single file has any benefit.

On the contrary, it will become quite difficult to manage because of all the dimensions and measures.

Furthermore, you can’t perform specific include statements if all the views are in a single file.

MikeD
New Member

My preference is to have a file per view. The main benefit is that it reduces the chance that two developers might make changes to the same file that are in conflict. Merges become easier. If you have multiple models in the same project, you can individually pick out which views you want to include more easily.

There are a few cases where putting multiple views in one file might make sense, however. First, if you have a project with hundreds of views it can be easier to have fewer files logically grouping the views together rather than navigating an enormous file list. If you have a view and then a second view that extends it, it might make sense to keep them in the same file.

While I think that having 1 view per file is a good default, I definitely would not get too serious about it!

In some cases, it makes sense to bundle many things into a single files.

And even as a default, I like to put a hidden base explore for each view right into the same file as the view.

Finally, I just shared a new pattern using LookML refinements that lets you better co-locate LookML that shares logic - and it uses multiple view declarations per file: Organizing your LookML into layers with our new refinement syntax

Thanks for all your responses! Really appreciate.

Top Labels in this Space
Top Solution Authors