繁体   English   中英

如何从Azure数据湖(存储账户)中读取R中的一个数据文件

[英]How to read a data file in R from Azure data lake (storage account)

我能够使用带有服务主体身份验证的 AzureAuth 和 AzureStor 包从 Azure 数据湖(存储帐户)上传和下载 Azure ML RStudio 中的数据文件。

我想从Azure数据湖(存储账户)中读取Azure ML RStudio中的一个数据文件。

这是 Azure ML Rstudio 中读取数据文件的代码片段:

# Install the AzureAuth and AzureStor packages
install.packages("AzureAuth")
install.packages("AzureStor")

# Load the AzureAuth and AzureStor packages
library(AzureAuth)
library(AzureStor)

# Authenticate with your Azure subscription using a service principal
azure_auth(tenant_id = "<your-tenant-id>",
           client_id = "<your-client-id>",
           client_secret = "<your-client-secret>")

# Connect to your Azure data lake (storage account)
azure_storage_account_name <- "<your-storage-account-name>"
azure_storage_account_key <- "<your-storage-account-key>"
azure_storage_account_container <- "<your-storage-account-container>"
azure_storage_account_file_path <- "<your-storage-account-file-path>"

azure_storage_account_connection <- AzureStor::az_storage_account(
  account_name = azure_storage_account_name,
  account_key = azure_storage_account_key
)

# Read the data file from Azure data lake (storage account)
data <- AzureStor::az_blob_download(
  connection = azure_storage_account_connection,
  container = azure_storage_account_container,
  file_path = azure_storage_account_file_path
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM