feat(ibis): query cache with bigquery info #1167
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant QueryCacheManager
participant BigQuery
Client->>API: POST /query?cacheEnable=true
API->>QueryCacheManager: _generate_cache_key(info, sql)
QueryCacheManager->>info: to_key_string()
QueryCacheManager->>QueryCacheManager: Build cache key string
API->>QueryCacheManager: Check cache for key
alt Cache miss
API->>BigQuery: Execute SQL query
BigQuery-->>API: Return results
API->>QueryCacheManager: Store results in cache
API-->>Client: Return results with X-Cache-Hit: false
else Cache hit
API->>QueryCacheManager: Retrieve cached results
API-->>Client: Return cached results with X-Cache-Hit: true
end
Client->>API: POST /query?cacheEnable=true&overrideCache=true
API->>QueryCacheManager: Override cache and execute query
API-->>Client: Return fresh results with X-Cache-Override: true
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
ibis-server/app/model/__init__.py(14 hunks)ibis-server/app/query_cache/__init__.py(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- ibis-server/app/query_cache/init.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
ibis-server/app/model/__init__.py (1)
ibis-server/tests/routers/v3/connector/postgres/conftest.py (1)
connection_url(48-50)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: ci
🔇 Additional comments (3)
ibis-server/app/model/__init__.py (3)
17-27: Well-designed base class for unified connection key generation.The new
BaseConnectionInfoclass provides a clean, unified way to generate cache keys from connection objects. Theto_key_string()method smartly collects allSecretStrfields and joins them, which ensures consistent cache key generation across different connection types.
87-89: Appropriate inheritance for ConnectionUrl.Moving
ConnectionUrlto inherit fromBaseConnectionInfoinstead of directly fromBaseModelensures consistent cache key generation, which is crucial for the query caching mechanism introduced in this PR.
91-91: Consistent inheritance pattern across all connection classes.All connection info classes now correctly inherit from
BaseConnectionInfo, which establishes a consistent pattern and guarantees that theto_key_string()method is available for all connection types. This is essential for the query caching mechanism to work properly with any connection type.Also applies to: 101-101, 120-120, 136-136, 161-161, 189-189, 205-205, 221-221, 241-241, 262-262, 271-271, 292-292, 318-318
We can support query cache from connection info using bigquery connection info.
Summary by CodeRabbit