Loading Data
Using the DataFrame.fromURL()
API, data can be loaded from any URL.
See TABLE construct for different ways of loading DataFrames.
Data as static assets
Docusaurus allows creating and bundling static assets such as images and media files.
It is also possible to bundle data files. For example, this template by default
has placed the file sales_10k.csv
in the ./static/data
directory. Below is an example
of how the file is accessed.
It is a good idea to cache the source DataFrames fetched from remote servers
to provide better performance as users navigate this website as the entire website
operates as a single page app and a DataFrame cached using S
is available when the
user revisits the page or even across pages!
See SQL Frames tutorial where the remotely fetched data is cached. Navigating within the website and revisiting the tutorial page indicates that the data is not fetched again.
Similarly, computationally expensive DataFrames can also be cached.
Data from remote servers
Since the data is loaded in the browser within the domain hosting the jamstack pages, the remote service providing the data should be on the same domain or have CORS enabled.
JAMSTACK expects the user authentication and permissions are handled by the API.
When the data is not sensitive or when this JAMSTACK analytics is used on localhost for individual use, then this is not a concern. For deploying this solution with user access restrictions, the API layer needs to handle the authentication and enforing the access policies. Users still benefit from the SQL Frames edge analytics by downloading the data that they have access to.