英文:
Adding a data source via REST call in Dremio
问题
我正在尝试使用REST API在Dremio中创建新的数据源。
尽管文档相当不错,但它们缺少实际示例,这就是我失败的地方。
因此,想要添加新的数据源,我执行以下REST调用:
- 登录以获取会话令牌
- 创建数据源:
这样我可以创建文件夹结构或创建基于预先存在的数据的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:
- Login to get the session token
- 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的示例:
-
认证以获取令牌
-
调用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
-
authenticate to get token
-
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论