Support per-query cache policies for file-based analytics queries
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- sql, typescript
调研方向
首先跟踪 useAnalyticsQuery 入口点和 analytics 插件配置,然后检查基于文件的查询如何在 JSON 和 Arrow 执行路径中进行缓存。定义每个查询的禁用策略或 TTL 策略如何保留现有默认值和执行隔离,并验证已禁用的查询会在没有 nonce 参数的情况下重新执行。
由索引模型根据 Issue 内容生成。
描述
Problem
AppKit's analytics plugin caches identical file-based SQL queries for one hour by default. Some queries are intentionally non-deterministic or calculate against current data and must execute every time the user submits them.
In AppKit 0.65.0, useAnalyticsQuery supports:
formatmaxParametersSizeautoStart
There is no per-query cache option. Caching can be disabled globally with:
createApp({
cache: {
enabled: false,
},
});
However, this disables caching for every AppKit plugin and analytics query in the application.
Example
-- config/queries/fresh_value.sql
SELECT current_timestamp() AS calculated_at
const { data } = useAnalyticsQuery('fresh_value');
After unmounting and remounting the component, the same cached timestamp is returned for up to an hour instead of executing the SQL again.
A more significant use case is a parameterized, non-deterministic table-valued function:
SELECT result_json
FROM IDENTIFIER(:functionName)(
:input,
:assumption
)
Submitting the same parameters again should deliberately recalculate against current source data.
Current workaround
We add a unique nonce to every submission:
-- @param queryNonce STRING
SELECT ...
WHERE length(:queryNonce) > 0
const [queryNonce] = useState(() => crypto.randomUUID());
const parameters = useMemo(
() => ({
input: sql.string(input),
queryNonce: sql.string(queryNonce),
}),
[input, queryNonce]
);
This works because parameters are part of the cache key, but it pollutes the SQL contract and creates cache entries that can never be reused.
Requested capability
Please support a server-controlled cache policy for individual file-based queries.
For example, a query directive:
-- @cache disabled
SELECT ...
Or configurable TTL:
-- @cache ttl=60
SELECT ...
Alternatively, plugin configuration could define the policy:
analytics({
queries: {
fresh_value: {
cache: false,
},
summary: {
cache: { ttl: 60 },
},
},
});
A client-side option such as the following would also be useful, although a server-owned policy would prevent clients from bypassing caching for arbitrary expensive queries:
useAnalyticsQuery('fresh_value', parameters, {
cache: 'no-store',
});
Expected behavior
- Existing queries remain cached by default.
- An individual query can disable caching or select a custom TTL.
- The policy applies consistently to JSON and Arrow execution paths.
- Service-principal and on-behalf-of-user execution retain their existing cache isolation.
- Disabled queries execute against the warehouse on every request without requiring dummy parameters.
- 主要语言
- TypeScript
- 星标
- 119
- 派生
- 36
- 平均合并
- 4 天 16 小时
- 30 天内合并 PR
- 37
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
databricks/appkit 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
databricks/appkit#729 ·
维护者通常 3 天内回复
-
@databricks/lakebase: pool drops maxLifetimeSeconds and other pg options, so connections never recycle and Unity Catalog claims access fails after 4 hours可能已有人在做 @billmcmillin 于 5 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 20/100
databricks/appkit#718 ·
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
databricks/appkit#699 ·
维护者通常 3 天内回复
-
难度 3/5 半天 新手友好度 42/100
databricks/appkit#656 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 28/100
databricks/appkit#648 · 2 条评论 ·
维护者通常 3 天内回复
查看 databricks/appkit 的全部 Issue
相似的 Issue
-
Add "append" and "prepend" slots for vue-vuetify extended renderers可能已有人在做 @simeyc 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eclipsesource/jsonforms#2668 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
README の通知条件を実際の判定処理に合わせる可能已有人在做 @unhappychoice 今天认领。 未关闭factory:in-progress priority:medium
难度 1/5 1 小时以内 新手友好度 90/100
unhappychoice/oss-issue-opener#395 · 1 条评论 ·
维护者通常 1 天内回复
-
bug Website
难度 2/5 1-3 小时 新手友好度 77/100
OWASP/OWASP-Hunting#88 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复