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.