embulk-input-postgresql 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41e2ea244907cf6cfc81009286f985a6357952fb
4
- data.tar.gz: a5cc2bd510fbe49a0c8c0a0d046ad739a06aad70
3
+ metadata.gz: 87724534f3076d4264cc4728fff2744c321c7982
4
+ data.tar.gz: 9914d0dfe4ef6d469de2da431e26b61c03c566e6
5
5
  SHA512:
6
- metadata.gz: ab0fa8e05dae0de13195383e8d3c9695d0fb78406d380b49315449fbeb5c80d83e7110ff3103bb9dc243e6415390250eaedd060f38b02848dabd87dc7f17e550
7
- data.tar.gz: 16e3207bf0565ee14bf27b0a2254a702708c839db8f24ac7fea3143b014ed6f377b26bdb267aff13059e6958b0d69bb87494249e326d496d82241ddb9f981297
6
+ metadata.gz: 031259689b5a0f86e7a530f2ebdce24255b65d7da54b9e55cf56f2d9d4c65f62087bc6189cb887147db24f95c45d437e42e9923c5be607fd173b7af80c05ca5c
7
+ data.tar.gz: 607b8e8e01d553badbeb7a4b881db6997ea721b2242bb373454785957fb188bbcbe2d416d5579e4f7dbe932de0bd5dcea6ad54e9c2c7f3f32a88c48608fbb088
@@ -6,6 +6,7 @@ import org.embulk.input.jdbc.JdbcColumnOption;
6
6
  import org.embulk.input.jdbc.JdbcInputConnection;
7
7
  import org.embulk.input.jdbc.getter.ColumnGetter;
8
8
  import org.embulk.input.jdbc.getter.ColumnGetterFactory;
9
+ import org.embulk.input.jdbc.getter.StringColumnGetter;
9
10
  import org.embulk.input.jdbc.getter.TimestampWithTimeZoneIncrementalHandler;
10
11
  import org.embulk.input.jdbc.getter.TimestampWithoutTimeZoneIncrementalHandler;
11
12
  import org.embulk.spi.PageBuilder;
@@ -31,6 +32,10 @@ public class PostgreSQLColumnGetterFactory extends ColumnGetterFactory
31
32
  return new ArrayColumnGetter(to, getToType(option));
32
33
  }
33
34
 
35
+ if ("uuid".equals(column.getTypeName())) {
36
+ return new StringColumnGetter(to, getToType(option));
37
+ }
38
+
34
39
  ColumnGetter getter = super.newColumnGetter(con, task, column, option);
35
40
 
36
41
  // incremental loading wrapper
@@ -0,0 +1,60 @@
1
+ package org.embulk.input.postgresql;
2
+
3
+ import static org.embulk.input.postgresql.PostgreSQLTests.execute;
4
+ import static org.embulk.test.EmbulkTests.readSortedFile;
5
+ import static org.hamcrest.Matchers.is;
6
+ import static org.junit.Assert.assertThat;
7
+
8
+ import java.nio.file.Path;
9
+
10
+ import org.embulk.config.ConfigSource;
11
+ import org.embulk.input.PostgreSQLInputPlugin;
12
+ import org.embulk.spi.InputPlugin;
13
+ import org.embulk.test.EmbulkTests;
14
+ import org.embulk.test.TestingEmbulk;
15
+ import org.embulk.test.TestingEmbulk.RunResult;
16
+ import org.junit.Before;
17
+ import org.junit.Rule;
18
+ import org.junit.Test;
19
+
20
+ public class UUIDTest
21
+ {
22
+ private static final String BASIC_RESOURCE_PATH = "org/embulk/input/postgresql/test/expect/uuid/";
23
+
24
+ private static ConfigSource loadYamlResource(TestingEmbulk embulk, String fileName)
25
+ {
26
+ return embulk.loadYamlResource(BASIC_RESOURCE_PATH + fileName);
27
+ }
28
+
29
+ private static String readResource(String fileName)
30
+ {
31
+ return EmbulkTests.readResource(BASIC_RESOURCE_PATH + fileName);
32
+ }
33
+
34
+ @Rule
35
+ public TestingEmbulk embulk = TestingEmbulk.builder()
36
+ .registerPlugin(InputPlugin.class, "postgresql", PostgreSQLInputPlugin.class)
37
+ .build();
38
+
39
+ private ConfigSource baseConfig;
40
+
41
+ @Before
42
+ public void setup()
43
+ {
44
+ baseConfig = PostgreSQLTests.baseConfig();
45
+ }
46
+
47
+ @Test
48
+ public void loadAsStringByDefault() throws Exception
49
+ {
50
+ execute(readResource("setup.sql"));
51
+
52
+ Path out1 = embulk.createTempFile("csv");
53
+ RunResult result1 = embulk.runInput(
54
+ baseConfig.merge(loadYamlResource(embulk, "as_string.yml")),
55
+ out1);
56
+ assertThat(
57
+ readSortedFile(out1),
58
+ is(readResource("expected_string.csv")));
59
+ }
60
+ }
@@ -0,0 +1 @@
1
+ d29977bb-55fb-4a9d-9e3b-97f52b191f49
@@ -0,0 +1,9 @@
1
+ drop table if exists input_uuid;
2
+
3
+ create table input_uuid (
4
+ c1 uuid
5
+ );
6
+
7
+ insert into input_uuid (c1) values
8
+ ('d29977bb-55fb-4a9d-9e3b-97f52b191f49')
9
+ ;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -19,8 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-input-jdbc-0.9.1.jar
23
- - classpath/embulk-input-postgresql-0.9.1.jar
22
+ - classpath/embulk-input-jdbc-0.9.2.jar
23
+ - classpath/embulk-input-postgresql-0.9.2.jar
24
24
  - default_jdbc_driver/postgresql-9.4-1205-jdbc41.jar
25
25
  - lib/embulk/input/postgresql.rb
26
26
  - src/main/java/org/embulk/input/PostgreSQLInputPlugin.java
@@ -32,6 +32,7 @@ files:
32
32
  - src/test/java/org/embulk/input/postgresql/HstoreTest.java
33
33
  - src/test/java/org/embulk/input/postgresql/IncrementalTest.java
34
34
  - src/test/java/org/embulk/input/postgresql/PostgreSQLTests.java
35
+ - src/test/java/org/embulk/input/postgresql/UUIDTest.java
35
36
  - src/test/resources/org/embulk/input/postgresql/test/expect/array/as_json.yml
36
37
  - src/test/resources/org/embulk/input/postgresql/test/expect/array/as_string.yml
37
38
  - src/test/resources/org/embulk/input/postgresql/test/expect/array/expected_json.csv
@@ -66,6 +67,9 @@ files:
66
67
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/timestamptz/expected_2.diff
67
68
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/timestamptz/insert_more.sql
68
69
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/timestamptz/setup.sql
70
+ - src/test/resources/org/embulk/input/postgresql/test/expect/uuid/as_string.yml
71
+ - src/test/resources/org/embulk/input/postgresql/test/expect/uuid/expected_string.csv
72
+ - src/test/resources/org/embulk/input/postgresql/test/expect/uuid/setup.sql
69
73
  homepage: https://github.com/embulk/embulk-input-jdbc
70
74
  licenses:
71
75
  - Apache 2.0