Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Local seed path containing a single quote breaks the DuckDB query

未关闭 适合新手
#1,102 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #1109 来自 @xubenqiang —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, databases

调研方向

阅读 packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py,重点关注 get_seed_dataset_size、get_column_names 和 build_dataset_read_query 的两个分支。首先检查每个方法如何构造 DuckDB SQL 字面量,并查找现有的 seed reader 测试。如果本地 seed 路径包含单引号时,列名、行数和数据集读取都能正常工作,则任务完成;运行相关测试,并为该路径补充测试覆盖。

由索引模型根据 Issue 内容生成。

描述

Priority Level

Low (Cosmetic / Minor)

Describe the bug

A local seed file whose path contains a single quote can't be read. SeedReader puts the dataset URI into DuckDB SQL as a quoted string literal without escaping it, so a ' anywhere in the path ends the literal early and DuckDB fails with a parser error. It happens with a directory like o'brien/ or anything under a home directory with an apostrophe in the user name.

The literal is built in four places in packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py on current main (4bb221eb). Those are get_seed_dataset_size (line 301), get_column_names (line 352) and both branches of build_dataset_read_query (lines 381 and 386), all in the form

f"SELECT COUNT(*) FROM '{self.get_dataset_uri()}'"
Steps/Code to reproduce bug
import os
import pandas as pd
import data_designer.config as dd
from data_designer.interface import DataDesigner

os.makedirs("o'brien", exist_ok=True)
pd.DataFrame({"name": ["a", "b"]}).to_parquet("o'brien/seed.parquet")

builder = dd.DataDesignerConfigBuilder()
builder.with_seed_dataset(dd.LocalFileSeedSource(path="o'brien/seed.parquet"))
builder.add_column(dd.ExpressionColumnConfig(name="greeting", expr="hi {{ name }}"))

result = DataDesigner(artifact_path="./artifacts").preview(builder, num_records=2)
print(result.dataset)

On main at 4bb221eb with Python 3.14 and duckdb 1.5.0 this gives (path shortened)

data_designer.interface.errors.DataDesignerGenerationError: 🛑 Error generating preview dataset: Parser Error: syntax error at or near "/"
LINE 1: ...o'brien/seed.parquet'
                  ^

The same script with the directory renamed to obrien works.

Expected behavior

The seed should load the same as from any other path.

Agent Diagnostic / Prior Investigation

Calling LocalFileSeedReader directly shows both get_column_names() and get_seed_dataset_size() failing with the same ParserException, so it's not specific to preview. In DuckDB a ' inside a string literal is written as '', and with the path escaped that way SELECT COUNT(*) FROM '...o''brien/seed.parquet' and the DESCRIBE query both work. The other readers aren't affected in practice. DataFrameSeedReader and the filesystem readers use the fixed table name df, and HuggingFaceSeedReader builds hf:// paths from repo ids. I searched issues and PRs for quote, apostrophe, seed path and get_dataset_uri and didn't find this reported.

Additional context

The fix I'd suggest is a small helper in SeedReader that doubles single quotes when building the SQL literal, used in those four spots. get_dataset_uri() itself should keep returning the raw path, since get_storage_plan also uses it with Path and glob. Happy to send a PR with tests once it's triaged.

Checklist
  • I reproduced this issue or provided a minimal example
  • I searched the docs/issues myself, or had my agent do so
  • If I used an agent, I included its diagnostics above
主要语言
Python
星标
2.4k
派生
241
平均合并
1 天 1 小时
30 天内合并 PR
86

环境准备

从这里开始

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

NVIDIA-NeMo/DataDesigner 的其他 Issue

查看 NVIDIA-NeMo/DataDesigner 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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