embulk-output-postgresql 0.7.12 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29efdbb543b08496679fb29e12ae77b35f4f1d94
4
- data.tar.gz: dc4089fb5739238d7a470deafb9982ffa5e926e8
3
+ metadata.gz: 9db342e9dcc2fd4352de1de73c59036f279f43cd
4
+ data.tar.gz: 0fa9050578f3cef664a324810b27054aa190e78b
5
5
  SHA512:
6
- metadata.gz: dccd56ad0416eaafc1042a0614b2ec5dafd9dea01b39e9b4fba4b0f2cbdb0c36a7b36f3bd6a27952856c4f237de6d1a25835a0db40468c7e6186214e20e78a00
7
- data.tar.gz: ce54e5533673dfec54a4586dc77de74fb5bc655cb049ef072544fedc257089fd30aa43dab56d12679df075b52273e895d9590b99da237e203555094ad09ea7eb
6
+ metadata.gz: 633d0743891e46768b60699e1ea346e4b5de288076c7b2b148b57039c2264edbec27e2e1706a5ed54e5aac78084c525d9c7c142d0159964ae731e940914e1ccb
7
+ data.tar.gz: 1133ad94178b49258423481ead37404a6f49d8c871aeaca4c9d40d283b143c3c14253ab4620f16e833042f273cc89f53231bd441349b4d9032ebfb4354e8172c
data/README.md CHANGED
@@ -10,6 +10,7 @@ PostgreSQL output plugin for Embulk loads records to PostgreSQL.
10
10
 
11
11
  ## Configuration
12
12
 
13
+ - **driver_path**: path to the jar file of the PostgreSQL JDBC driver. If not set, the bundled JDBC driver (PostgreSQL JDBC Driver 9.4-1205) will be used. (string)
13
14
  - **host**: database host name (string, required)
14
15
  - **port**: database port number (integer, default: 5432)
15
16
  - **user**: database login user name (string, required)
@@ -18,6 +19,8 @@ PostgreSQL output plugin for Embulk loads records to PostgreSQL.
18
19
  - **schema**: destination schema name (string, default: "public")
19
20
  - **temp_schema**: schema name for intermediate tables. by default, intermediate tables will be created in the schema specified by `schema`. replace mode doesn't support temp_schema. (string, optional)
20
21
  - **table**: destination table name (string, required)
22
+ - **create_table_constraint** table constraint added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
23
+ - **create_table_option** table option added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
21
24
  - **options**: extra connection properties (hash, default: {})
22
25
  - **retry_limit** max retry count for database operations (integer, default: 12)
23
26
  - **retry_wait** initial retry wait time in milliseconds (integer, default: 1000 (1 second))
@@ -2,6 +2,7 @@ dependencies {
2
2
  compile project(':embulk-output-jdbc')
3
3
 
4
4
  compile 'org.postgresql:postgresql:9.4-1205-jdbc41'
5
+ defaultJdbcDriver 'org.postgresql:postgresql:9.4-1205-jdbc41'
5
6
 
6
7
  testCompile project(':embulk-output-jdbc').sourceSets.test.output
7
8
  }
@@ -27,6 +27,10 @@ public class PostgreSQLOutputPlugin
27
27
  public interface PostgreSQLPluginTask
28
28
  extends PluginTask
29
29
  {
30
+ @Config("driver_path")
31
+ @ConfigDefault("null")
32
+ public Optional<String> getDriverPath();
33
+
30
34
  @Config("host")
31
35
  public String getHost();
32
36
 
@@ -67,7 +71,7 @@ public class PostgreSQLOutputPlugin
67
71
  protected Features getFeatures(PluginTask task)
68
72
  {
69
73
  return new Features()
70
- .setMaxTableNameLength(30)
74
+ .setMaxTableNameLength(63)
71
75
  .setSupportedModes(ImmutableSet.of(Mode.INSERT, Mode.INSERT_DIRECT, Mode.MERGE, Mode.MERGE_DIRECT, Mode.TRUNCATE_INSERT, Mode.REPLACE))
72
76
  .setIgnoreMergeKeys(false);
73
77
  }
@@ -77,6 +81,8 @@ public class PostgreSQLOutputPlugin
77
81
  {
78
82
  PostgreSQLPluginTask t = (PostgreSQLPluginTask) task;
79
83
 
84
+ loadDriver("org.postgresql.Driver", t.getDriverPath());
85
+
80
86
  String url = String.format("jdbc:postgresql://%s:%d/%s",
81
87
  t.getHost(), t.getPort(), t.getDatabase());
82
88
 
@@ -1,16 +1,15 @@
1
1
  package org.embulk.output.postgresql;
2
2
 
3
3
  import java.util.Properties;
4
- import java.sql.Driver;
5
4
  import java.sql.Connection;
5
+ import java.sql.DriverManager;
6
6
  import java.sql.SQLException;
7
+
7
8
  import org.embulk.output.jdbc.JdbcOutputConnector;
8
9
 
9
10
  public class PostgreSQLOutputConnector
10
11
  implements JdbcOutputConnector
11
12
  {
12
- private static final Driver driver = new org.postgresql.Driver();
13
-
14
13
  private final String url;
15
14
  private final Properties properties;
16
15
  private final String schemaName;
@@ -25,7 +24,7 @@ public class PostgreSQLOutputConnector
25
24
  @Override
26
25
  public PostgreSQLOutputConnection connect(boolean autoCommit) throws SQLException
27
26
  {
28
- Connection c = driver.connect(url, properties);
27
+ Connection c = DriverManager.getConnection(url, properties);
29
28
  try {
30
29
  PostgreSQLOutputConnection con = new PostgreSQLOutputConnection(c, schemaName, autoCommit);
31
30
  c = null;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.12
4
+ version: 0.7.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-12-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -19,9 +19,9 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-output-jdbc-0.7.12.jar
23
- - classpath/embulk-output-postgresql-0.7.12.jar
24
- - classpath/postgresql-9.4-1205-jdbc41.jar
22
+ - classpath/embulk-output-jdbc-0.7.13.jar
23
+ - classpath/embulk-output-postgresql-0.7.13.jar
24
+ - default_jdbc_driver/postgresql-9.4-1205-jdbc41.jar
25
25
  - lib/embulk/output/postgresql.rb
26
26
  - src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java
27
27
  - src/main/java/org/embulk/output/postgresql/AbstractPostgreSQLCopyBatchInsert.java