Expose SessionContext.register_variable / deregister_variable for SQL @var support
還沒有人認領這個 Issue。
評估
研究方向
該 issue 提到了 PySessionContext、一個 PyVarProvider Rust wrapper,以及一個面向 Python 的 ABC,但沒有提供檔案或測試。首先追蹤現有的 PySessionContext bindings,以及 upstream SessionContext 中 register_variable 和 deregister_variable 的簽名。當 Python 呼叫端能夠提供一個 VarProvider、註冊和解除註冊它,並且能夠安全地跨越 GIL 邊界接收回呼時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Background
DataFusion's SessionContext exposes register_variable(var_type, provider) and deregister_variable(var_type) for plugging in a VarProvider that resolves SQL @var / @@var references at execution time. These were surfaced during a v54 upstream coverage audit but are not exposed in the Python bindings.
Upstream signature
pub fn register_variable(&self, var_type: VarType, provider: Arc<dyn VarProvider + Send + Sync>)
pub fn deregister_variable(&self, var_type: VarType) -> Option<Arc<dyn VarProvider + Send + Sync>>
VarProvider is a small trait with get_value(&self, name: Vec<String>) -> Result<ScalarValue> and get_type(&self, name: &[String]) -> Option<DataType>.
User value
Enables SQL like SELECT * FROM sales WHERE region = @current_region AND user_id = @user_id where the provider supplies per-query values. Useful for multi-tenant SaaS embedders, BI / notebook tools that want session-scoped parameters without f-string interpolation (no SQL injection risk), and tools porting MySQL / Postgres SQL that uses session variables.
Why deferred
Effort estimate is medium (~250-400 LOC): needs a PyVarProvider Rust wrapper that calls back into a user-supplied Python object across the GIL boundary, plus the register / deregister bindings on PySessionContext, plus a Python-facing ABC. No open user requests at the time of audit, so the work is currently speculative. Filed for tracking; revisit when a concrete user need surfaces or to complete the upstream surface area.
- 主要語言
- Python
- 星號
- 605
- 分支
- 176
- 平均合併
- 1 天 23 小時
- 30 天內合併 PR
- 8
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/datafusion-python 的其他 Issue
-
documentation
難度 2/5 1-3 小時 新手友好度 72/100
apache/datafusion-python#1726 ·
-
難度 2/5 半天 新手友好度 88/100
apache/datafusion-python#1691 ·
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
apache/datafusion-python#1644 ·
-
enhancement
難度 5/5 一週以上 新手友好度 30/100
apache/datafusion-python#1737 ·
-
難度 3/5 1-2 天 新手友好度 76/100
apache/datafusion-python#1735 · 1 則留言 ·
查看 apache/datafusion-python 的全部 Issue
相似的 Issue
-
triage/confirmed
難度 2/5 1-3 小時 新手友好度 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難度 1/5 1 小時以內 新手友好度 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難度 1/5 1 小時以內 新手友好度 90/100
apache/cloudstack#14222 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
-
bug
難度 2/5 1-3 小時 新手友好度 82/100