【问题标题】:Create Polybase tables from DataBricks从 DataBricks 创建 Polybase 表
【发布时间】:2020-03-16 09:11:06
【问题描述】:

作为 Datawarehouse 的新手,我有一个新要求,即从 Datalake(GEN1/GEN2) 创建 EXTERNAL TABLE 到 Databricks 的 DWH。我使用link 创建以下代码。

// Set up the Blob storage account access key in the notebook session conf.
spark.conf.set(
  "fs.azure.account.key.<your-storage-account-name>.blob.core.windows.net",
  "<your-storage-account-access-key>")

// Get some data from a SQL DW table.
val df: DataFrame = spark.read
  .format("com.databricks.spark.sqldw")
  .option("url", "jdbc:sqlserver://<the-rest-of-the-connection-string>")
  .option("tempDir", "wasbs://<your-container-name>@<your-storage-account-name>.blob.core.windows.net/<your-directory-name>")
  .option("forwardSparkAzureStorageCredentials", "true")
  .option("dbTable", "my_table_in_dw")
  .load()

我写的代码

%scala

Class.forName("com.databricks.spark.sqldw.DefaultSource")

import org.apache.spark.sql.functions._ 
import org.apache.spark.sql.{DataFrame, SQLContext}


spark.conf.set("fs.azure.account.key.xxxxxxxxx.blob.core.windows.net", "xxxxxxxxxxxxxxx")

    // Load data from a SQL DW query
   val df: DataFrame = spark.read
  .format("com.databricks.spark.sqldw")
  .option("url", "jdbc:sqlserver://xxxxxxxxxxx.database.windows.net:1433;database=xxxxxxxx")
  .option("tempDir", "wasbs://xxxxxxxxx@xxxxxxxxx.blob.core.windows.net")
  .option("forwardSparkAzureStorageCredentials", "true")
  .option("dbTable", "dbo.EXT_TEST") 
  .load()

这是抛出一个错误: com.databricks.spark.sqldw.SqlDWConnectorException:在 SQL DW 连接器代码中遇到异常。 我哪里错了?任何帮助将不胜感激。

【问题讨论】:

    标签: azure-databricks azure-sql-data-warehouse polybase azure-data-lake-gen2


    【解决方案1】:

    确保按照以下格式传递“tempDir”。

    tempDir = "wasbs://" + blobContainer + "@" + blobStorage +"/tempDirs"
    

    参考:Load data into Azure SQL Data Warehouse

    您可以参考GitHub issue 中概述的建议,它解决了类似的问题。

    希望这会有所帮助。

    【讨论】:

    • 很高兴知道它有帮助。
    猜你喜欢
    • 2019-06-29
    • 2019-12-17
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    • 2021-05-04
    • 2020-09-14
    • 2019-07-01
    • 1970-01-01
    相关资源
    最近更新 更多