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

使用一键式引入将 CSV 数据从容器引入到 Azure 数据资源管理器中的新表Use one-click ingestion to ingest CSV data from a container to a new 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.

本文档介绍如何在特定用例中使用直观的一键式向导将容器中的 CSV 数据引入新表 。This document describes using the intuitive one-click wizard in a specific use case to ingest CSV data from a container into a new table. 可以使用稍微改动的同一过程来覆盖各种不同的用例。You can 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. 若要了解如何将数据引入 Azure 数据资源管理器中的现有表,请参阅一键式引入到现有表中For information about ingesting data into an existing table in Azure Data Explorer, see One-click ingestion to an existing table

引入新数据Ingest new data

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


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

  3. 选择“创建新表”并输入新表的名称。Select Create new table and enter a name for the new table. 可以使用字母数字字符、连字符和下划线。You can use alphanumeric, hyphens, and underscores. 不支持特殊字符。Special characters aren't supported.


    表名称必须介于 1 到 1024 个字符之间。Table names must be between 1 and 1024 characters.


选择引入类型Select an ingestion type

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

  1. 选择“从容器”Select from container

  2. 在“链接到存储”字段中,添加容器的 SAS URL,并选择性地输入样本大小。In the Link to storage field, add the SAS URL of the container, and optionally enter the sample size.


此时会显示数据样本。A sample of the data appears. 如果需要,请筛选数据,仅引入以特定字符开头或结尾的文件。If you want to, filter the data to ingest only files that begin end with specific characters. 调整筛选器时,预览会自动更新。When you adjust the filters, the preview automatically updates.

例如,筛选以 .csv 扩展名开头的所有文件。For example, filter for all files that begin with the word .csv extension.


编辑架构Edit the schema

选择“编辑架构”以查看并编辑表列配置。Select Edit schema to view and edit your table column configuration. 系统会随机选择一个 Blob,并基于该 Blob 生成架构。The system will select one of the blobs at random and the schema will be generated based on that blob. 服务会通过检查源的名称自动确定该源是否已压缩。By looking at the name of the source, the service automatically identifies if it is compressed or not.

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

  1. 选择“数据格式”:Select Data format:

    在这种情况下,数据格式为 CSVIn this case, the data format is CSV

  2. 可以选中“包括列名”复选框,以忽略文件的标题行。You can select the check box Include column names to ignore the heading row of the file.


在“映射名称”字段中输入映射名称。In the Mapping name field, enter a mapping name. 可以使用字母数字字符和下划线。You can use alphanumeric characters and underscores. 不支持空格、特殊字符和连字符。Spaces, special characters, and hyphens aren't supported.


编辑表Edit the table

引入到新表后,在创建表时可以更改表的各个方面。When ingesting to a new table, alter various aspects of the table when creating the table.

在表中:In the table:

  • 双击新列名称进行编辑。Double-click the new column name to edit.

  • 选择新列标题并执行以下任一操作:Select new column headers and do any of the following actions:

    操作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)


可将表格格式的每个列引入到 Azure 数据资源管理器的某个列中。For tabular formats, each column can be ingested into one column in Azure Data Explorer.

命令编辑器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.

为容器创建持续引入Create continuous ingestion for container

使用连续引入可以创建一个侦听源容器中新文件的事件网格。Continuous ingestion enables you to create an event grid that listens for new files in the source container. 任何满足预定义参数(前缀、后缀等)条件的新文件都会自动引入到目标表中。Any new file that meets the criteria of the pre-defined parameters (prefix, suffix, and so on) will be automatically ingested into the destination table.

  1. 在“连续引入”磁贴中选择“事件网格”,以打开 Azure 门户 。Select Event Grid in the Continuous ingestion tile to open the Azure portal. 此时会打开数据连接页,其中打开了事件网格数据连接器,并已输入了源和目标参数(源容器、表和映射)。The data connection page opens with the event grid data connector opened and with source and target parameters already entered (source container, tables, and mappings).


  2. 选择“创建”,以创建用于侦听该容器中发生的任何更改、更新或新数据的数据连接。Select Create to create a data connection which will listen for any changes, updates, or new data in that container.


后续步骤Next steps