0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Databricks にて Azure Storage 上の Apache Iceberg を CLONE する際の Invalid configuration value detected エラーへの暫定対応方法

Posted at

概要

Databricks 上でストレージキーにて Azure Storage 上の Apache Iceberg のデータを CLONE しようとした際の暫定対応方法を共有します。Blob Storage エンドポイントを指定しているにもかかわらず、内部で dfs エンドポイントにより接続していることがエラーの原因のようです。dfs に対する認証情報も追加する暫定対応を共有します。

Py4JJavaError: An error occurred while calling o400.sql.
: Invalid configuration value detected for fs.azure.account.key
at shaded.databricks.azurebfs.org.apache.hadoop.fs.azurebfs.dia

image.png

image.png

Py4JJavaError: An error occurred while calling o400.sql.
: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: Unable to access container snowflake in account snowflakeicebergqiita.blob.core.windows.net using anonymous credentials, and no credentials found for them in the configuration.

Unity Catalog に外部ロケーションとして登録しているディレクトリの場合においても、上記の 2 つのエンドポイントに対する認証設定が必要でした。

Py4JJavaError: An error occurred while calling o400.sql.
: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: Unable to access container external in account {account_name}.blob.core.windows.net using anonymous credentials, and no credentials found for them in the configuration.

image.png

エラーについて

Unity Catalog が有効なクラスターのアタッチ

cluster_info = spark.conf.get("spark.databricks.clusterUsageTags.sparkVersion")
display(cluster_info)

image.png

Blob Storage エンドポイントの認証を設定

# Azure Storage に関る情報をセット
azure_storage_account_name = "snowflakeicebergqiita"
azure_storage_account_key = "kKRn6nruDHEhUF0AQzM1PFlXtXs9V0BJQSrn6Z8GvJOsb0JHflV9Fn=="
spark.conf.set(f"fs.azure.account.key.{azure_storage_account_name}.blob.core.windows.net", azure_storage_account_key)

image.png

CLONE がエラーとなることを確認

retund_df = spark.sql(f"""
CREATE OR REPLACE TABLE iceberg_clone_test.default.test_table_01
  CLONE iceberg.`wasbs://snowflake@{azure_storage_account_name}.blob.core.windows.net/iceberg_clone/default/first_table`;
""")
retund_df.display()

Py4JJavaError: An error occurred while calling o400.sql.
: Invalid configuration value detected for fs.azure.account.key
at shaded.databricks.azurebfs.org.apache.hadoop.fs.azurebfs.dia

image.png

エラーへの対応方法

dfs エンドポイントに対する認証を設定

spark.conf.set(
    f"fs.azure.account.key.{azure_storage_account_name}.dfs.core.windows.net",
    azure_storage_account_key,
)

image.png

CLONE できることを確認

retund_df = spark.sql(f"""
CREATE OR REPLACE TABLE iceberg_clone_test.default.test_table_01
  CLONE iceberg.`wasbs://snowflake@{azure_storage_account_name}.blob.core.windows.net/iceberg_clone/default/first_table`;
""")
retund_df.display()

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?