mongodb ingest data into databricks error
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 12:37 AM
spark = SparkSession.builder \
.appName("MongoDBToDatabricks") \
.config("spark.jars.packages", "org.mongodb.spark:mongo-spark-connector_2.12:10.4.0") \
.config("spark.mongodb.read.connection.uri", mongodb_uri) \
.config("spark.mongodb.write.connection.uri", mongodb_uri) \
.getOrCreate()
# Read data from MongoDB
df = spark.read \
.format("com.mongodb.spark.sql.connector.MongoTableProvider") \
.option("database", database_name) \
.option("collection", collection_name) \
.option("readPreference", "primary") \
.load()
df.printSchema()
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 12:40 AM
it shows maximun number of retires has been exceeded. i have no idea why it couldnt connect as i able to telnet to mongoDB
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 02:40 AM
Hello @jeft , will you be able to share some screenshots of the driver logs?

