Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Snowflake output plugin for Embulk loads records to Snowflake.
- **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default)
- **before_load**: if set, this SQL will be executed before loading all records. In truncate_insert mode, the SQL will be executed after truncating. replace mode doesn't support this option.
- **after_load**: if set, this SQL will be executed after loading all records.
- **treat_decimal_as_int**: If set to true, this plugin treats NUMBER columns as BigInt columns. If false, it treats as BigDecimal. (boolean, default: true)

### Modes

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/embulk/output/SnowflakeOutputPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public interface SnowflakePluginTask extends PluginTask {
@ConfigDefault("\"none\"")
public MatchByColumnName getMatchByColumnName();

@Config("treat_decimal_as_int")
@ConfigDefault("true")
public boolean getTreatDecimalAsInt();

public void setCopyIntoTableColumnNames(String[] columnNames);

public String[] getCopyIntoTableColumnNames();
Expand Down Expand Up @@ -183,6 +187,8 @@ protected JdbcOutputConnector getConnector(PluginTask task, boolean retryableMet
props.setProperty("CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX", "true");
props.setProperty("MULTI_STATEMENT_COUNT", "0");

props.setProperty("JDBC_TREAT_DECIMAL_AS_INT", t.getTreatDecimalAsInt() ? "true" : "false");

props.putAll(t.getOptions());

logConnectionProperties(url, props);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.embulk.output.snowflake;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -209,7 +210,8 @@ public void testConfigDefault() throws Exception {
assertEquals("", task.getPassword());
assertEquals("public", task.getSchema());
assertEquals("", task.getRole());
assertEquals(false, task.getDeleteStage());
assertFalse(task.getDeleteStage());
assertTrue(task.getTreatDecimalAsInt());
}

@Test
Expand Down