从 Microsoft Azure 批量加载¶
如果您已经拥有 Microsoft Azure 账户并使用 Azure Blob 存储容器来存储和管理数据文件,则可以利用现有容器和文件夹路径,批量加载到 Snowflake 中。
Note
To harden your security posture, you can configure your bulk load to use private connectivity rather than the public Internet. For more information, see Private connectivity to external stages and Snowpipe automation for Microsoft Azure.
这组主题介绍了如何使用 COPY 命令将数据从 Azure 容器加载到表中。
Snowflake 目前仅支持从 Blob 存储中加载。Snowflake 支持以下类型的存储账户:
- Blob 存储
- Data Lake Storage Gen2
- 常规用途 v1
- General-purpose v2
- Microsoft Fabric OneLake
Snowflake 不 支持 Data Lake Storage Gen1。
Note
-
对于 Microsoft Fabric OneLake,Snowflake 不支持以下功能:
- 自动化 Snowpipe
- 外部表和目录表自动刷新
- 专用连接
-
Loading from block, append, and page blobs is supported. Unloaded files are created as block blobs. For information about these blob types, see the Azure documentation on blob types (https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-block-blobs–append-blobs–and-page-blobs).
-
If a hierarchical namespace is enabled on Data Lake Storage Gen2, Snowflake doesn’t support purging files with the COPY command. A hierarchical namespace organizes data into directories and subdirectories. Azure only allows you to delete empty directories, which means that you can’t delete directories recursively by using the PURGE option with the COPY command.
如下图所示,从 Azure 容器加载数据分两步执行:
- Step 1:
Snowflake 假定数据文件已暂存在 Azure 容器中。如果尚未暂存,请使用 Microsoft 提供的上传接口/实用程序来暂存文件。
- Step 2:
Use the COPY INTO <table> command to load the contents of the staged file(s) into a Snowflake database table. You can load directly from the bucket, but Snowflake recommends creating an external stage that references the bucket and using the external stage instead.
无论您使用哪种方法,如果您手动或在脚本中执行命令,此步骤都需要运行一个当前虚拟仓库的会话。仓库提供计算资源,以执行将行实际插入到表中的操作。

Note
只要您的 Snowflake 账户托管在 Azure 上,您的网络流量就不会穿过公共互联网。
Tip
The instructions in this set of topics assume you have read Preparing to load data and have created a named file format, if desired.
Before you begin, you may also want to read Data loading considerations for best practices, tips, and other guidance.
后续主题:
-
配置任务(根据需要完成):
-
数据加载任务(针对您加载的每组文件完成):