The JSON file
country_sales.json is accessed directly by RAW.
Since it contains nested data, we "denormalize" it by turning it into a regular flat table, through a SQL extension (see the FROM statement).
The data is also cleaned: item IDs are added a
"i#" prefix and the
date field is converted into a timestamp.
products.txt is a plain text file containing the description of products.
The text file is converted into a structured collection of records using the
PARSE AS keyword,
which splits the string into tokens, and converts each token into a record.
As a result,
items now looks like a regular SQL table and can be queried as such.
items are regular tables, these can be joined.
This query joins a JSON file with a text file, both of which have been preprocessed using RAW queries.
Note that no schemas were created, no data was explicitly loaded and no separate ETL process or scripts were needed: these optimizations are all done internally by RAW and transparent to the user.