DuckDB `register` is not visible from `con.cursor()`

未关闭
#282 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
database

调研方向

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

xqlsystems/xarray-sql 的其他 Issue

查看 xqlsystems/xarray-sql 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。