From 64f85be51050e08498fc240776b53b5d8d7eb483 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Sun, 15 Dec 2024 16:08:26 -0800 Subject: [PATCH] Escape correctly. --- clients/databricks/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/databricks/store.go b/clients/databricks/store.go index 74d86b2c7..02df68b94 100644 --- a/clients/databricks/store.go +++ b/clients/databricks/store.go @@ -122,7 +122,7 @@ func (s Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizatio // Copy file from DBFS -> table via COPY INTO, ref: https://docs.databricks.com/en/sql/language-manual/delta-copy-into.html // We'll need \\\\N here because we need to string escape. - copyCommand := fmt.Sprintf(`COPY INTO %s BY POSITION FROM '%s' FILEFORMAT = CSV FORMAT_OPTIONS ('delimiter' = '\t', 'header' = 'false', 'nullValue' = '\\\\N')`, tempTableID.FullyQualifiedName(), file.DBFSFilePath()) + copyCommand := fmt.Sprintf(`COPY INTO %s BY POSITION FROM '%s' FILEFORMAT = CSV FORMAT_OPTIONS ('escape' = '"', 'delimiter' = '\t', 'header' = 'false', 'nullValue' = '\\\\N')`, tempTableID.FullyQualifiedName(), file.DBFSFilePath()) if _, err = s.ExecContext(ctx, copyCommand); err != nil { return fmt.Errorf("failed to run COPY INTO for temporary table: %w", err) }