> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/run-sql-on-files-directly.md).

# Run SQL on files directly

Instead of using read API to load a file into DataFrame and query it, you can also query that file directly with SQL.

```
val sqlDF = spark.sql("SELECT * FROM parquet.`file:///home/dv6/spark/spark/examples/src/main/resources/users.parquet`")
```
