cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

MySQL Connection: too many positional arguments in '.options()'

190809
Contributor

Hi there,

i am trying to set yp the connection to a PlanetScale MySQL database. I have followed all of the configuration steps but receive the following:

remote_table = (spark.read

.format("jdbc")\

.option("driver", driver)\

.option("url", url)\

.option("dbtable", table)\

.option("user", username)\

.option("password", passwd)\

.option("ssl", True) \

.options("sslmode", "require" ) \

.options("sslcert", "dbfs:/mnt/*****-data-landing/admin/my_cert.pem") \

.load()

)

error message:

TypeError: options() takes 1 positional argument but 3 were given

--------------------------------------------------------------------------- TypeError Traceback (most recent call last)

<command-3539186329914624> in <module>

12 url = "<url_path>"

13 --->

14 remote_table = (spark.read

15 .format("jdbc")\

16 .option("driver", driver)\

TypeError: options() takes 1 positional argument but 3 were given

I am aware this Type error is a bit of a needle in a haystack kind of situation but if anyone has come across this before or can see anything obvious in my setup. First time connecting to MySQL in Datarbicks. Thanks

4 REPLIES 4

Kaniz
Community Manager
Community Manager

Hi @Rachel Cunninghamโ€‹, Probably you missed the quotation marks. Please give this a try.

remote_table = (spark.read
 
.format("jdbc")\
 
.option("driver", "driver")\
 
.option("url", "url")\
 
.option("dbtable","table")\
 
.option("user", "username")\
 
.option("password", "passwd")\
 
.option("ssl", "True") \
 
.options("sslmode", "require" ) \
 
.options("sslcert", "dbfs:/mnt/*****-data-landing/admin/my_cert.pem") \
 
.load()
 
)
 

Hi thanks, no this was not the solution but i fixed it.

Kaniz
Community Manager
Community Manager

Hi @Rachel Cunninghamโ€‹, Thank you for your response. Would you like to share the solution with the community?

Kaniz
Community Manager
Community Manager

Hi @Rachel Cunninghamโ€‹, We havenโ€™t heard from you since my last response, and I was checking back to see if my suggestions helped you.

Or else, If you have any solution, please share it with the community, as it can be helpful to others.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!