lib/gzr/modules/model.rb in gazer-0.3.3 vs lib/gzr/modules/model.rb in gazer-0.3.4
- old
+ new
@@ -34,7 +34,36 @@
say_error e
raise
end
data
end
+
+ def cat_model(model_name)
+ begin
+ return @sdk.lookml_model(model_name)&.to_attrs
+ rescue LookerSDK::NotFound => e
+ return nil
+ rescue LookerSDK::Error => e
+ say_error "Error getting lookml_model(#{model_name})"
+ say_error e
+ raise
+ end
+ end
+
+ def trim_model(data)
+ data.select do |k,v|
+ keys_to_keep('create_lookml_model').include? k
+ end
+ end
+
+ def create_model(body)
+ begin
+ return @sdk.create_lookml_model(body)&.to_attrs
+ rescue LookerSDK::Error => e
+ say_error "Error running create_lookml_model(#{JSON.pretty_generate(body)})"
+ say_error e
+ raise
+ end
+ end
+
end
end