Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SQL syntax of {% cache %} ... {% endcache %} tag #152

Closed
Tracked by #150
kokokuo opened this issue Apr 6, 2023 · 0 comments · Fixed by #162
Closed
Tracked by #150

Support SQL syntax of {% cache %} ... {% endcache %} tag #152

kokokuo opened this issue Apr 6, 2023 · 0 comments · Fixed by #162
Assignees

Comments

@kokokuo
Copy link
Contributor

kokokuo commented Apr 6, 2023

What’s the problem you're trying to solve

In #150, In order to enhance our query performance after users send the API request to run our data endpoint to get the result from the data source. We need to provide a Caching (pre-loading) Layer with the duckDB to enhance query performance.

Describe the solution you’d like

Define the tag scope of {% cache %} ... {% endcache %} to parse the scope of {% cache %} ... {% endcache %} tag and send the SQL to duckDB.

-- The "cache" scope means the SQL statement will send the query to duckDB cache data source
{% cache %}
select * from order
  where type = {{ context.params.type }}
  and where exists (
    select * from product  where price >= {{ context.params.price }}
    and order.product_id = product.id
  )
{% endcache %}

Additional Context

In the build time, define a CacheTagBuilder to parse {% cache %} … {% endcache %} to the AST tree, set the cache metadata name cache.vulcan.com to make schema parser #151 to work, then keep to the artifact.

@kokokuo kokokuo changed the title Support {% cache %} ... {% endcache %} Tag SQL syntax Support SQL syntax of {% cache %} ... {% endcache %} tag Apr 6, 2023
@kokokuo kokokuo self-assigned this Apr 6, 2023
@kokokuo kokokuo moved this to In process in Vulcan SQL Roadmap May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In process
1 participant