How to query a MySQL Table from Databricks?

Swapnil1998
New Contributor III

I wanted to query a MySQL Table using Databricks rather than reading the complete data using a dbtable option, which will help in incremental loads.

remote_table = (spark.read

 .format("jdbc")

 .option("driver", driver)

 .option("url", URL)

 .option("query", query)

 .option("user", user)

 .option("password", password)

 .load()

)

Kindly let me know if there is some way to pass a query like

SELECT * FROM table_name WHERE last_modified_date > 'yyyy-mm-dd';

Regards,

Swapnil