您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用一键式引入将 JSON 数据从本地文件引入到 Azure 数据资源管理器中的现有表Use one-click ingestion to ingest JSON data from a local file to an existing table in Azure Data Explorer

借助一键式引入,可将 JSON、CSV 和其他格式的数据快速引入表中并轻松创建映射结构。One-click ingestion enables you to quickly ingest data in JSON, CSV, and other formats into a table and easily create mapping structures. 数据可以从存储、本地文件或容器引入,可以是一次性引入过程,也可以是持续引入过程。The data can be ingested either from storage, from a local file, or from a container, as a one-time or continuous ingestion process.

本文档介绍如何在特定用例中使用直观的一键式向导将本地文件中的 JSON 数据引入到现有表中 。This document describes using the intuitive one-click wizard in a specific use case to ingest JSON data from a local file into an existing table. 使用稍微改动的同一过程来覆盖各种不同的用例。Use the same process with slight adaptations to cover a variety of different use cases.

有关一键式引入的概述和先决条件列表,请参阅一键式引入For an overview of one-click ingestion and a list of prerequisites, see One-click ingestion. 如需了解数据的不同类型或源,请参阅使用一键式引入将 CSV 数据从容器引入到 Azure 数据资源管理器中的新表For different types or sources of data, see Use one-click ingestion to ingest CSV data from a container to a new table in Azure Data Explorer.

引入新数据Ingest new data

在 Web UI 的左侧菜单中,右键单击“数据库”或“表”,并选择“引入新数据(预览版)”。 In the left menu of the Web UI, right-click a database or table and select Ingest new data (Preview).

在 Web UI 中选择一键式引入

选择引入类型Select an ingestion type

  1. 在“引入新数据(预览版)”窗口中,“源”选项卡处于选中状态。 In the Ingest new data (Preview) window, the Source tab is selected.

  2. 如果“表”字段未自动填充,请从下拉菜单中选择一个现有的表名。If the Table field isn't automatically filled, select an existing table name from the drop-down menu.

    备注

    如果在“表”行中选择了“引入新数据(预览版)”,选定的表名称将显示在“项目详细信息”中。If you select Ingest new data (Preview) on a table row, the selected table name will appear in the Project Details.

  3. 在“引入类型”下,执行以下步骤:Under Ingestion type, do the following steps:

    1. 选择“从文件”Select from file

    2. 选择“浏览”以找到文件,或者将文件拖放到字段中。Select Browse to locate the file, or drag the file into the field.

      从文件进行一键式引入

  4. 此时会显示数据样本。A sample of the data appears. 筛选数据,仅引入以特定字符开头或结尾的文件。Filter the data to ingest only files that begin or end with specific characters.

    备注

    调整筛选器时,预览会自动更新。When you adjust the filters, the preview automatically updates.

编辑架构Edit the schema

选择“编辑架构”以查看并编辑表列配置。Select Edit schema to view and edit your table column configuration.

映射列Map columns

  1. “映射列”对话框打开。The Map columns dialog opens. 将一个或多个源列或属性附加到 Azure 数据资源管理器列。Attach one or more source columns or attributes to your Azure Data Explorer columns.

    • 自动设置新映射,或使用现有映射。New mappings are set automatically, or use an existing mapping.

    • 在“源列”字段中,输入要与“目标列”相映射的列名称。 In the Source columns fields, enter column names to map with the Target columns.

    • 若要从映射中删除列,请选择垃圾桶图标。To delete a column from mapping, select the trash can icon.

      “映射列”窗口

  2. 选择“更新”。Select Update.

  3. 在“架构”选项卡中:In the Schema tab:

编辑表Edit the table

将数据引入现有表后,更改表时会受到更多的限制。When ingesting data to an existing table, you are more limited in the changes you may make to the table.

在表中:In the table:

  • 选择新列标题,以添加新列、删除列、按升序排序或按降序排序。 Select new column headers to add a New column, Delete column, Sort ascending, or Sort descending.
  • 在现有列中,只能对数据排序。On existing columns, only data sorting is available.
操作Action 说明Description
更改数据类型Change data type 将数据类型从服务自动选择的类型更改为其他支持的数据类型之一Change the data type from the one automatically selected by the service to one of the other supported data types
重命名列Rename column 更改列名称Change the column name
新列New column 添加新列。Add a new column. 可将表格格式的每个列引入到 ADX 上的一个列。For tabular formats, each column can be ingested into one column on ADX. 可以从其他 JSON 级别创建一个新列。A new column can be created from a different JSON level.
删除列Delete column 删除选定的列Delete the selected column
按升序排序Sort ascending 按选定列的升序将表排序(仅限现有列)Sort the table by the selected column in ascending order (existing columns only)
按降序排序Sort descending 按选定列的降序将表排序(仅限现有列)Sort the table by the selected column in descending order (existing columns only)

命令编辑器Command editor

在“编辑器”窗格上方选择“v”按钮,打开编辑器。 Above the Editor pane, select the v button to open the editor. 在编辑器中,可以查看和复制基于输入生成的自动命令。In the editor, you can view and copy the automatic commands generated from your inputs.

备注

不能更新现有表的名称和数据类型。You can't update the name and datatype for existing tables.

一键式引入编辑视图

开始引入Start ingestion

选择“开始引入”,在创建表和映射后开始引入数据。Select Start ingestion to create a table and mapping and to begin data ingestion.

开始引入

完成数据引入Complete data ingestion

如果数据引入成功完成,则“数据引入已完成”窗口中的所有三个步骤都会带有绿色的对勾标记。In the Data ingestion completed window, all three steps will be marked with green check marks when data ingestion finishes successfully.

一键式数据引入已完成

探索快速查询和工具Explore quick queries and tools

在引入进度下方的磁贴中,探索“快速查询”或“工具” :In the tiles below the ingestion progress, explore Quick queries or Tools:

  • “快速查询”包含指向 Web UI(其中包含示例查询)的链接。Quick queries includes links to the Web UI with example queries.

  • “工具”包含一个指向 Web UI 上的“撤消”或“删除新数据”的链接,因此,你可以通过运行相关的 .drop 命令来排查问题 。Tools includes links to Undo or Delete new data on the Web UI, which enable you to troubleshoot issues by running the relevant .drop commands.

    备注

    使用 .drop 命令时,可能会丢失数据。You might lose data when you use .drop commands. 请谨慎使用。Use them carefully. Drop 命令只会还原此引入流所做的更改(新建范围和列),Drop commands will only revert the changes that were made by this ingestion flow (new extents and columns). 而不会删除任何其他内容。Nothing else will be dropped.

后续步骤Next steps