通过REST调用在Dremio中添加数据源

huangapple go评论106阅读模式
英文:

Adding a data source via REST call in Dremio

问题

我正在尝试使用REST API在Dremio中创建新的数据源。

尽管文档相当不错,但它们缺少实际示例,这就是我失败的地方。

因此,想要添加新的数据源,我执行以下REST调用:

  1. 登录以获取会话令牌
  2. 创建数据源
    这样我可以创建文件夹结构或创建基于预先存在的数据的SQL查询的虚拟数据集。但我无法将新的PHYSICAL_DATASET添加或将VIRTUAL_DATASET提升为物理数据集。

我收到HTTP 400错误,消息是要提升的实体在给定路径上不存在(但我可以验证它存在)。

有没有任何使用Dremio的REST经验的人能够提供一些指导。

谢谢!

英文:

I am trying to create a new data source in Dremio using REST API.

While the docs are pretty decent, they lack real examples which is where I fail.

So wanting to add a new data source I do the following REST calls:

  1. Login to get the session token
  2. Create a datasource:
    So I can create a folder structure or create a virtual dataset which is based on SQL query of pre-existing data. However I am failing to add a new PHYSICAL_DATASET or promote VIRTUAL_DATASET to a physical one.

I am getting HTTP 400 with a message that the entity to promote with a given path does not exist (when I can verify it does)

Anybody with any experience using Dremio's REST should be able to shed some light.

Thank you!

答案1

得分: 2

你能描述一下你的PHYSICAL_DATASET吗?

  • 格式是csv还是parquet?
  • 数据源是NAS吗?

能否在这里添加你的代码和文件示例?

以下是csv的示例:

  1. 认证以获取令牌

  2. 调用POST localhost:9047/api/v3/catalog/{id}

    {
    "entityType": "dataset",
    "path": ["REST", "data.csv"],
    "type": "PHYSICAL_DATASET",
    "format": {
    "type": "Text",
    "fieldDelimiter": ",",
    "lineDelimiter": "\n",
    "quote": """,
    "escape": """,
    "skipFirstLine": false,
    "extractHeader": true,
    "trimHeader": false,
    "autoGenerateColumnNames": true
    }
    }

要获取{id},请访问localhost:9047/api/v3/catalog/by-path/SPACE/FILE,并将{id}进行URL编码。

英文:

Can you describe your PHYSICAL_DATASET

  • format csv, parquet?
  • Source NAS?

can you add an example of your code and file here

here example for csv

  1. authenticate to get token

  2. Call POST localhost:9047/api/v3/catalog/{id}

    {
    "entityType": "dataset",
    "path": ["REST", "data.csv"],
    "type": "PHYSICAL_DATASET",
    "format": {
    "type": "Text",
    "fieldDelimiter": ",",
    "lineDelimiter": "\n",
    "quote": """,
    "escape": """,
    "skipFirstLine": false,
    "extractHeader": true,
    "trimHeader": false,
    "autoGenerateColumnNames": true
    }

    }

to get {id} localhost:9047/api/v3/catalog/by-path/SPACE/FILE =>"id": ?
{id} should be URLencoded

huangapple
  • 本文由 发表于 2020年8月11日 02:07:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/63345693.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定