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

Not able to create a file from view #66

Open subbaraocherukuri opened 2 years ago

subbaraocherukuri commented 2 years ago

view_name = lookml.View('test_n') lookml.File(view_name) Traceback (most recent call last): File "", line 1, in File python3.8\3.8.10\lib\site-packages\lookml\lib\project.py", line 47, in init self.name = self.path.split('/')[-1] TypeError: 'NoneType' object is not callable

subbaraocherukuri commented 2 years ago

https://github.com/llooker/pylookml/blob/25f4b026944d0bf7dc932fdb4ce0d1a60f34403f/lookml/tests/scenarios/scenario_gen_from_schema_test.py#L69

rahultesla commented 2 years ago

Hi @subbaraocherukuri ,

lookml.File Function accepts string (path of the file) as argument instead of View object.

russlooker commented 2 years ago

The code for this would be:

view = lookml.View('test_n')
my_file = lookml.File('test_n.view.lkml')
my_file + view