Partilhar via


Introdução às APIs de tabela do OneLake para Delta

OneLake oferece um endpoint de API REST para interagir com tabelas em Microsoft Fabric. Este ponto de extremidade suporta operações de metadados somente leitura para tabelas Delta no Fabric. Essas operações são compatíveis com o padrão aberto da API do Unity Catalog.

Importante

Este recurso está em pré-visualização.

Exemplos de pedidos e respostas

Esses exemplos de solicitações e respostas ilustram o uso das operações da API Delta atualmente suportadas no ponto de extremidade da API da tabela OneLake.

Para cada uma destas operações:

  • <BaseUrl> é https://onelake.table.fabric.microsoft.com/delta
  • <Workspace>/DataItem > pode ser:
    • <WorkspaceID>/<DataItemID>, tais como 12345678-abcd-4fbd-9e50-3937d8eb1915/98765432-dcba-4209-8ac2-0821c7f8bd91
    • <WorkspaceName>/<DataItemName>.<DataItemType>, como MyWorkspace/MyItem.Lakehouse, desde que ambos os nomes não contenham
      caracteres.
  • <Token> é o valor do token de acesso retornado pela ID do Microsoft Entra após a autenticação bem-sucedida.

Listar esquemas

Liste esquemas dentro de um item de dados de estrutura.

  • Pedido
curl -X GET \
  "<BaseUrl>/<Workspace>/testlh.Lakehouse/api/2.1/unity-catalog/schemas?catalog_name=testlh.Lakehouse" \
  -H "Authorization: Bearer <Token>" \
  -H "Content-Type: application/json"
  • Resposta
200 OK
{
"schemas": [
	{
		"name": "dbo",
		"catalog_name": "testlh.Lakehouse",
        "full_name": "testlh.Lakehouse.dbo",
		"created_at": 1759768029062,
		"updated_at": 1759768029062,
		"comment": null,
		"properties": null,
		"owner": null,
		"created_by": null,
		"updated_by": null,
		"schema_id": null
	}
],
"next_page_token": null
}

Listar tabelas

Listar tabelas dentro de um determinado esquema.

  • Pedido
curl -X GET \
  "<BaseUrl>/<Workspace>/testlh.Lakehouse/api/2.1/unity-catalog/tables?catalog_name=testlh.Lakehouse&schema_name=dbo" \
  -H "Authorization: Bearer <Token>" \
  -H "Content-Type: application/json"
  • Resposta
200 OK
{
"tables": [
    {
        "name": "product_table",
        "catalog_name": "testlh.Lakehouse",
        "schema_name": "dbo",
        "table_type": null,
        "data_source_format": "DELTA",
        "columns": null,
        "storage_location": "https://onelake.dfs.fabric.microsoft.com/.../.../Tables/product_table",
        "comment": null,
        "properties": null,
        "owner": null,
        "created_at": null,
        "created_by": null,
        "updated_at": null,
        "updated_by": null,
        "table_id": null
    }
],
"next_page_token": null
}

Obter tabela

Obter detalhes de uma tabela específica.

Pedido

curl -X GET \
  "<BaseUrl>/<Workspace>/testlh.Lakehouse/api/2.1/unity-catalog/tables/testlh.Lakehouse.dbo.product_table" \
  -H "Authorization: Bearer <Token>" \
  -H "Content-Type: application/json"

Resposta

    200 OK
    {
	"name": "product_table",
	"catalog_name": "testlh.Lakehouse",
	"schema_name": "dbo",
	"table_type": null,
	"data_source_format": "DELTA",
	"columns": [
		{
			"name": "product_id",
			"type_text": null,
			"type_json": null,
			"type_name": "string",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 0,
			"nullable": true
		},
		{
			"name": "product_name",
			"type_text": null,
			"type_json": null,
			"type_name": "string",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 1,
			"nullable": true
		},
		{
			"name": "category",
			"type_text": null,
			"type_json": null,
			"type_name": "string",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 2,
			"nullable": true
		},
		{
			"name": "brand",
			"type_text": null,
			"type_json": null,
			"type_name": "string",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 3,
			"nullable": true
		},
		{
			"name": "price",
			"type_text": null,
			"type_json": null,
			"type_name": "double",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 4,
			"nullable": true
		},
		{
			"name": "launch_date",
			"type_text": null,
			"type_json": null,
			"type_name": "date",
			"type_precision": 0,
			"type_scale": 0,
			"type_interval_type": null,
			"comment": null,
			"partition_index": 0,
			"position": 5,
			"nullable": true
		}
	],
	"storage_location": "https://onelake.dfs.fabric.microsoft.com/.../.../Tables/product_table",
	"comment": null,
	"properties": null,
	"owner": null,
	"created_at": 1759703452000,
	"created_by": null,
	"updated_at": 1759703452000,
	"updated_by": null,
	"table_id": "df2b3038-c21a-429d-90b8-f3bbf2d3db5d"
    }