Reputation: 27
I have one SQL scripts file In that file there is some sql query I want to upload it on dbfs and read it from azure databricks and execute querys from the script on azure databricks
Upvotes: 1
Views: 4801
Reputation: 448
Databricks does not directly support the execution of .sql files. However you could just read them into a string and execute them.
with open("/dbfs/path/to/query.sql") as queryFile:
queryText = queryFile.read()
results = spark.sql(queryText)
Upvotes: 3