首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用Looker API将Looker图表(视图)拉入Databricks

无法使用Looker API将Looker图表(视图)拉入Databricks
EN

Stack Overflow用户
提问于 2019-11-06 03:38:23
回答 1查看 96关注 0票数 1

我的目标是访问我存储在Looker文件夹中的视图或图表,并自动将它们添加到power point幻灯片中。我正在学习的教程是这个:https://discourse.looker.com/t/generating-a-powerpoint-presentation-from-all-looks-in-a-space/8191

我的问题是#生成PowerPoint (根据教程)。当我运行该命令时,失败消息指出:

代码语言:javascript
复制
    103 chart_test
    Look failed 103: chart_test
    Failed to add image to slide

This corresponds to this piece of code where it fails:

try:
    image = looker_client.LookApi(client).run_look(**look_request)
    image_file = ''.join([str(look.id), '.png'])
    shutil.move(image, image_file)
except:
    print(f'Look failed {look.id}: {look.title}')
    image_file = None

当我打印'image_file‘时,是空的('None'),尽管我在这个名为' chart _test’的文件夹2703中保存了一个折线图。

有人能帮帮忙吗?

EN

回答 1

Stack Overflow用户

发布于 2020-06-03 01:06:19

检查参数示例

代码语言:javascript
复制
look_request = {
            "look_id": 21, 
            "result_format": 'png', 
            "image_width": 960, 
            "image_height": 540
        } 

尝试使用上一个sdk

代码语言:javascript
复制
import looker_sdk
import shutil 
from looker_sdk import models
sdk = looker_sdk.init40("looker.ini")
look_request = {
            "look_id": 21, 
            "result_format": 'html', 
            "image_width": 960, 
            "image_height": 540
        }

try:
    image1 = sdk.run_look(**look_request)
    image_file1 = '21.png'
    shutil.move(image1, image_file1)
except Exception as e:
    print(e)

您应该在py文件所在的文件夹中创建一个looker.ini文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58718310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档