Repository navigation
Local seed path containing a single quote breaks the DuckDB query #1102
Description
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 (4bb221e). 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 4bb221e 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
Activity
xubenqiang commentedon Oct 28, 2026
I opened #1109 for this one, and the linked-issue check closed it because the issue has not been triaged yet. The fix and a regression test are ready on the fork; a riaged label would let me reopen it.
v0ropaev commentedon Oct 28, 2026
I have a fix for this on my fork as well (
v0ropaev:fix/seed-uri-quote), same quote doubling in all four places, with the test parametrized overo'brien,it''sand'quoted'. I was holding it until triage since CONTRIBUTING asks for that. Either one is fine with me, whichever the maintainers prefer.@xubenqiang one thing if you reopen yours, the diff turns the 🛑 in two error messages in seed_reader.py into
馃洃. Looks like the file went through a non-UTF-8 encoding on save.