Skip to content

Commit

Permalink
Merge pull request #69 from kenkoooo/main
Browse files Browse the repository at this point in the history
Add `role` to config
  • Loading branch information
d-hrs authored Feb 26, 2024
2 parents 8d9b552 + 93ac09c commit 4c1b68d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Snowflake output plugin for Embulk loads records to Snowflake.
- **database**: destination database name (string, required)
- **schema**: destination schema name (string, default: "public")
- **table**: destination table name (string, required)
- **role**: role to execute queries (string, default: "")
- **retry_limit**: max retry count for database operations (integer, default: 12). When intermediate table to create already created by another process, this plugin will retry with another table name to avoid collision.
- **retry_wait**: initial retry wait time in milliseconds (integer, default: 1000 (1 second))
- **max_retry_wait**: upper limit of retry wait, which will be doubled at every retry (integer, default: 1800000 (30 minutes))
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/embulk/output/SnowflakeOutputPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public interface SnowflakePluginTask extends PluginTask {
@ConfigDefault("\"public\"")
public String getSchema();

@Config("role")
@ConfigDefault("\"\"")
public String getRole();

@Config("delete_stage")
@ConfigDefault("false")
public boolean getDeleteStage();
Expand Down Expand Up @@ -120,6 +124,9 @@ protected JdbcOutputConnector getConnector(PluginTask task, boolean retryableMet
props.setProperty("warehouse", t.getWarehouse());
props.setProperty("db", t.getDatabase());
props.setProperty("schema", t.getSchema());
if (!t.getRole().isEmpty()) {
props.setProperty("role", t.getRole());
}

// When CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX is false (default),
// getMetaData().getColumns() returns columns of the tables which table name is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void testConfigDefault() throws Exception {
assertEquals("", task.getUser());
assertEquals("", task.getPassword());
assertEquals("public", task.getSchema());
assertEquals("", task.getRole());
assertEquals(false, task.getDeleteStage());
}

Expand Down

0 comments on commit 4c1b68d

Please sign in to comment.