From cc5298a6a684a4f6ae5899718ca2eb8a48451c80 Mon Sep 17 00:00:00 2001 From: mzumi Date: Mon, 10 Jun 2024 08:27:27 +0000 Subject: [PATCH] Wrap names with double quotes --- .../java/org/embulk/output/SnowflakeOutputPlugin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java b/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java index 7f34019..0afc206 100644 --- a/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java +++ b/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java @@ -167,8 +167,7 @@ protected JdbcOutputConnector getConnector(PluginTask task, boolean retryableMet throw new ConfigException(e); } } - - props.setProperty("warehouse", t.getWarehouse()); + props.setProperty("warehouse", wrapDoubleQuates(t.getWarehouse())); props.setProperty("db", t.getDatabase()); props.setProperty("schema", t.getSchema()); if (!t.getRole().isEmpty()) { @@ -368,4 +367,12 @@ public void timestampColumn(Column column) { } return new JdbcSchema(Collections.unmodifiableList(columns)); } + + private String wrapDoubleQuates(String s) { + if (s.startsWith("\"") && s.endsWith("\"")) { + return s; + } + + return "\"" + s + "\""; + } }