You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the previous, users should define the SQL query file mapped API spec including URL, request parameter, data source profile name, or cache feature, they should define in YAML format, but when YAML content is longer, it is not easy to read and define, so there are a lot of articles share don't use YAML.
Describe the solution you’d like
Otherwise, we also hope to decrease more config files, so we decide to define a tag {% schema set(...) %} and put all API schema config in the set(...) function by js object.
{% schema set({
urlPath: "/artist/:id"
request: [{
fieldName: id
fieldIn: path
description: constituent id
validators: [required]
}],
profiles: ["pg"]
cache: {
product: { sql: "select * from product"},
order: {
sql: "select * from order",
# optional
refreshTime: "5m",
# optional
refreshExpression: {
expression: "MAX(created_at)"
every: "5m"
}
# optional
index: {
idx_a: 'col_a'
idx_b: 'col_b'
}
}
}
}) %}
-- SQL# 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 }}
andwhere exists (
select*from product where price >= {{ context.params.price }}
andorder.product_id=product.id
)
{% endcache %}
Additional context
The text was updated successfully, but these errors were encountered:
What’s the problem you're trying to solve
In the previous, users should define the SQL query file mapped API spec including URL, request parameter, data source profile name, or cache feature, they should define in YAML format, but when YAML content is longer, it is not easy to read and define, so there are a lot of articles share don't use YAML.
Describe the solution you’d like
Otherwise, we also hope to decrease more config files, so we decide to define a tag
{% schema set(...) %}
and put all API schema config in theset(...)
function by js object.Additional context
The text was updated successfully, but these errors were encountered: