DuckDB `register` is not visible from `con.cursor()`
維護者通常 3 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start by reading the implementation and documentation for register, arrow_dataset, and from_arrow; the issue does not name their file paths. Reproduce the example with DuckDB 1.5.6 and xarray-sql 0.6.0, comparing queries through con and con.cursor(). Decide whether to document the view workaround or add a view option, then verify the documented or implemented behavior across cursors.
由索引模型根據 Issue 內容生成。
描述
xql.register(con, name, ds) on a DuckDB connection works on that handle, but a cursor from the same connection cannot see the table. Apps that run each query on con.cursor() (for thread safety, as Lumen's DuckDBSource does) then get a CatalogException.
import duckdb, xarray as xr, xarray_sql as xql
ds = xr.Dataset({"t": ("x", [1.0, 2.0])}, coords={"x": [0, 1]})
con = duckdb.connect()
xql.register(con, "grid", ds)
con.sql("SELECT COUNT(*) FROM grid").fetchall() # [(2,)]
con.cursor().sql("SELECT COUNT(*) FROM grid").fetchall() # CatalogException: Table with name grid does not exist!
A view works from every cursor:
con.from_arrow(xql.arrow_dataset(ds)).to_view("grid_view")
con.cursor().sql("SELECT COUNT(*) FROM grid_view").fetchall() # [(2,)]
I think this comes from DuckDB keeping Python-registered objects per connection handle, so it may be a docs note rather than a bug. Would an option on register that creates a view (or a line in the docs pointing to from_arrow(arrow_dataset(ds)).to_view(name)) make sense?
duckdb 1.5.6, xarray-sql 0.6.0
- 主要語言
- Python
- 星號
- 142
- 分支
- 19
- 平均合併
- 3 天 47 分鐘
- 30 天內合併 PR
- 8
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
xqlsystems/xarray-sql 的其他 Issue
-
dependencies github_actions
難度 2/5 1-3 小時 新手友好度 70/100
xqlsystems/xarray-sql#295 ·
維護者通常 3 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
xqlsystems/xarray-sql#288 ·
維護者通常 3 天內回覆
-
documentation ml
難度 1/5 1-3 小時 新手友好度 85/100
xqlsystems/xarray-sql#268 ·
維護者通常 3 天內回覆
-
enhancement ml
難度 2/5 1-3 小時 新手友好度 64/100
xqlsystems/xarray-sql#267 · 4 則留言 ·
維護者通常 3 天內回覆
-
難度 1/5 1 小時以內 新手友好度 74/100
xqlsystems/xarray-sql#243 ·
維護者通常 3 天內回覆
查看 xqlsystems/xarray-sql 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
strawberry-graphql/strawberry#4794 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
dataforgoodfr/cetolog#21 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
btclib-org/btclib#2932 ·
維護者通常 1 天內回覆
-
metrics priority: medium
難度 1/5 1-3 小時 新手友好度 86/100
LearningCircuit/local-deep-research#8336 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100