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

lookml.Model.include(explore) #9

Closed bryan-at-looker closed 4 years ago

bryan-at-looker commented 4 years ago

You should be able to include an explore file to a model file. Possibly related to this #8

This currently doesn't work:

import lookml
vw = lookml.View('new-view')
ex = lookml.Explore(vw)
md = lookml.Model('new-model')
md.include(vw)
md.include(ex)
(v) 15er:tracks bryanweber$ python testing.py 
Traceback (most recent call last):
  File "testing.py", line 8, in <module>
    print(md)
  File "/Users/bryanweber/python/lookml/lookml/lookml.py", line 712, in __str__
    '\n'.join([str(p) for p in self.properties.getProperties()]), 
  File "/Users/bryanweber/python/lookml/lookml/lookml.py", line 712, in <listcomp>
    '\n'.join([str(p) for p in self.properties.getProperties()]), 
  File "/Users/bryanweber/python/lookml/lookml/lookml.py", line 821, in getProperties
    yield Property(k, n)
  File "/Users/bryanweber/python/lookml/lookml/lookml.py", line 775, in __init__
    raise Exception('not a dict, list or string')
Exception: not a dict, list or string