From 1eab6904e9e7c09711d39613b0f5c768ea46f508 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Wed, 13 Nov 2024 14:19:39 -0500 Subject: [PATCH] Ignore errors for DuckDB column detection and preview --- src/utils/DuckDB.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/DuckDB.js b/src/utils/DuckDB.js index c154783..d7a63ec 100644 --- a/src/utils/DuckDB.js +++ b/src/utils/DuckDB.js @@ -74,7 +74,7 @@ class DuckDB { const db = await this.getDb(); const conn = await db.connect(); const fileName = this.getFileName(uuid, FILE_TYPE.CSV); - const query = `DESCRIBE SELECT * FROM READ_CSV('${fileName}', delim=?, quote=?, escape=?, header=${hasHeader}) LIMIT 1`; + const query = `DESCRIBE SELECT * FROM READ_CSV('${fileName}', delim=?, quote=?, escape=?, header=${hasHeader}, ignore_errors=true) LIMIT 1`; console.debug(query); let preparedQuery = await conn.prepare(query); let result = await preparedQuery.query(delimiter, quote, escape); @@ -130,7 +130,7 @@ class DuckDB { const db = await this.getDb(); const conn = await db.connect(); const fileName = this.getFileName(uuid, FILE_TYPE.CSV); - const query = `SELECT * FROM READ_CSV('${fileName}', delim=?, quote=?, escape=?, header=${hasHeader}) LIMIT ${limit}`; + const query = `SELECT * FROM READ_CSV('${fileName}', delim=?, quote=?, escape=?, header=${hasHeader}, ignore_errors=true) LIMIT ${limit}`; console.debug(query); let preparedQuery = await conn.prepare(query); let result = await preparedQuery.query(delimiter, quote, escape);