Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Local seed path containing a single quote breaks the DuckDB query

Aperta Adatta ai principianti
#1,102 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #1109 di @xubenqiang — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, databases

Direzione di ricerca

Leggi packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py, concentrandoti su get_seed_dataset_size, get_column_names e su entrambi i rami di build_dataset_read_query. Per prima cosa controlla come ciascun metodo costruisce il proprio letterale SQL DuckDB e cerca i test esistenti del seed reader. Il lavoro è completato quando un percorso locale di seed contenente un apostrofo funziona per i nomi delle colonne, i conteggi delle righe e le letture del dataset; esegui i test pertinenti e aggiungi test per questo percorso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
2.4k
Fork
241
Merge medio
1g 19m
PR unite (30g)
84

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA-NeMo/DataDesigner

Tutte le issue di NVIDIA-NeMo/DataDesigner

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.