Local seed path containing a single quote breaks the DuckDB query

Open Beginner friendly
#1,102 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@xubenqiang is already working on this.

Since Oct 28, 2026.

  • #1109 by @xubenqiang — open
  • #1196 by @sailtrack410 — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, databases

Research direction

Read packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py, focusing on get_seed_dataset_size, get_column_names and both branches of build_dataset_read_query. Start by checking how each method builds its DuckDB SQL literal and look for existing seed reader tests. Done means a local seed path containing a single quote works for column names, row counts and dataset reads; run the relevant tests and add coverage for that path.

Written by the indexing model from the issue text.

Description

bug triaged
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
Dominant language
Python
Stars
2.4k
Forks
258
Avg merge
4d 20m
Merged PRs (30d)
32

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA-NeMo/DataDesigner

All issues in NVIDIA-NeMo/DataDesigner

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.