looker-open-source / pylookml

A pythonic api for automatic lookml
https://pylookml.readthedocs.io/en/latest/introduction.html
MIT License
44 stars 22 forks source link

Support arbitrary .lkml file types #18

Closed tpakeman closed 4 years ago

tpakeman commented 4 years ago

It would be great to support arbitrary file extensions that end .lkml rather than throwing an exception (lookml.py line 629). I have worked on projects where people use all sorts of file types for organisation, like foo.tests.lkml or bar.datagroups.lkml

tpakeman commented 4 years ago

Potentially could implement something like this as it seems that filetypes are not really used apart from as metadata:

if self.name.endswith(".model.lkml"):
...
else:
    if self.name.endswith('lkml'):
        self.filetype = self.name.split('.')[-2]
    else:
        raise Exception("Unsupported filename " + self.name)
russlooker commented 4 years ago

Makes sense! Will do

tpakeman commented 4 years ago

fixed in https://github.com/llooker/lookml/commit/66e78ff139a61eac9a94e602ffb4ce4cf92b7257