Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2025 02:54 PM - edited 10-27-2025 02:56 PM
Something like this?
import os
query_name = "test_query.sql"
query_path = os.path.abspath(query_name)
# Read query contents
with open(query_path, "r") as f:
query_str = f.read()
# Run it
spark.sql(query_str)You can read the script from the sql file and assuming the file is in the same directory as the notebook you are running.