From 808510746e110bf133f441ff9c5d7fc8d23be8d3 Mon Sep 17 00:00:00 2001 From: yyh Date: Thu, 22 Jan 2026 16:25:43 +0800 Subject: [PATCH] fix: show columns for empty sqlite tables --- .../workflow/skill/hooks/use-sqlite-database.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/skill/hooks/use-sqlite-database.ts b/web/app/components/workflow/skill/hooks/use-sqlite-database.ts index b0c8b30d85..9050a480e2 100644 --- a/web/app/components/workflow/skill/hooks/use-sqlite-database.ts +++ b/web/app/components/workflow/skill/hooks/use-sqlite-database.ts @@ -210,8 +210,17 @@ export function useSQLiteDatabase(downloadUrl: string | undefined): UseSQLiteDat `SELECT * FROM "${safeName}"${resolvedLimit ? ` LIMIT ${resolvedLimit}` : ''}`, [], ) + let columns = result.columns + if (columns.length === 0) { + const columnResult = await client.sqlite3.execWithParams( + db, + `PRAGMA table_info("${safeName}")`, + [], + ) + columns = columnResult.rows.map(row => String(row[1])) + } const data: SQLiteQueryResult = { - columns: result.columns, + columns, values: result.rows as SQLiteValue[][], } cacheRef.current.set(cacheKey, data)