简体   繁体   English

如何将 application.conf 文件读入数据块?

[英]How to read application.conf file into databricks?

I am having a application.conf file in ADLS GEN-2.我在 ADLS GEN-2 中有一个 application.conf 文件。 I was trying to read the file into databricks by mounting the container.我试图通过安装容器将文件读入数据块。 I was doing below and file is not begin read.我在下面做,文件没有开始读取。

import com.typesafe.config.{Config, ConfigFactory}                                                                                          
val fileConfig = ConfigFactory.parseFile(new File("dbfs:/mnt/configs/application.conf"))
val appConfig = ConfigFactory.load(fileConfig).getConfig("HeNAppConf").getConfig(s"$env")

I am getting error like : No configuration setting found for key 'HeNAppConf'.我收到如下错误:未找到密钥“HeNAppConf”的配置设置。 But I am having但我有

The ConfigFactory class should work only with local file APIs, so it doesn't understand dbfs: style of paths. ConfigFactory类应该只适用于本地文件 API,因此它不理解dbfs:路径样式。 But you can access data via local file API if you replace dbfs: with /dbfs , like this:但是,如果将dbfs:替换为/dbfs ,则可以通过本地文件 API访问数据,如下所示:

import com.typesafe.config.{Config, ConfigFactory}
val fileConfig = ConfigFactory.parseFile(
  new File("/dbfs/mnt/configs/application.conf"))

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

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