添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
发怒的棒棒糖  ·  HoYoLAB - Official ...·  1 月前    · 
心软的黑框眼镜  ·  HoYoLAB - Official ...·  3 天前    · 
发怒的洋葱  ·  Data types — Polars ...·  4 月前    · 
酒量小的椰子  ·  Attributes - C# ...·  7 月前    · 
Databricks

Hi community,

I wanted to understand if there is a way to pass config values to spark session in runtime than using databricks-connect configure to run spark code.

One way I found out is given here: https://stackoverflow.com/questions/63088121/configuring-databricks-connect-using-python-os-module

The other way was running a code like: SparkSession.builder.appName('NewSpark').getOrCreate(), and then exporting spark conf creds, i.e:
spark.conf.set("spark.databricks.service.token", "<token>")
spark.conf.set("spark.databricks.service.address", "<address"), etc.

But using above approach gives me error: Caused by: java.lang.RuntimeException: Config file /home/ec2user/.databricks-connect not found. Please run `databricks-connect configure` to accept the end user license agreement and configure Databricks Connect.

Can I have a case where the .databricks config file is not created/populated, but via spark conf code we are able to run spark code?

Hi @Surajv , To pass configuration values to a Spark session at runtime in PySpark without relying on the Databricks Connect configuration, you can access and set Spark configuration parameters programmatically. First, retrieve the current Spark context settings using `spark.sparkContext.getConf().getAll()`. Then, set custom configuration parameters using `spark.conf.set("key", "value")` within your Spark application. Ensure that your Spark code sets necessary parameters and handles missing `.databricks-connect` configuration files to avoid errors. Remember to stop the Spark session (`spark.stop()`) when done.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.

Click here to register and join today!

Engage in exciting technical discussions , join a group with your peers and meet our Featured Members.

Unable to provide access in unity catalog using SQL commands in Community Discussions Secrete management in Administration & Architecture Cannot run another notebook from same directory in Data Engineering © Databricks 2024. All rights reserved. Apache, Apache Spark, Spark and the Spark logo are trademarks of the Apache Software Foundation.
  • Privacy Notice
  • Terms of Use
  • Your Privacy Choices
  • Your California Privacy Rights
  •