embulk-input-sqlserver 0.9.1 → 0.9.2
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 +4 -4
- data/README.md +1 -0
- data/classpath/{embulk-input-jdbc-0.9.1.jar → embulk-input-jdbc-0.9.2.jar} +0 -0
- data/classpath/embulk-input-sqlserver-0.9.2.jar +0 -0
- data/src/main/java/org/embulk/input/SQLServerInputPlugin.java +17 -1
- data/src/main/java/org/embulk/input/sqlserver/SQLServerInputConnection.java +12 -0
- data/src/main/java/org/embulk/input/sqlserver/getter/SQLServerColumnGetterFactory.java +30 -0
- metadata +5 -4
- data/classpath/embulk-input-sqlserver-0.9.1.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c16ee19779397cd99053ee70ba2f598f3a325bf8
|
4
|
+
data.tar.gz: c47ff7d2bd88a005e388155922ebf564061c9e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75539ff9386b73939da535ce0e771447150e760e2f625349202173af75d981497ca923297724352540a3effe9ae6cb675bab72263cb246cf64d13ea56861e7e2
|
7
|
+
data.tar.gz: 9cf2395a6589ac9b03696f5170766601ce7cd50bb481cb171b0264d83d033fbb8efd3a4ecb5ae52b1c4fa993f5f36d440f4be4cbc9c1c713680b74f44dcacf0e
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ embulk "-J-Djava.library.path=C:\drivers" run input-sqlserver.yml
|
|
27
27
|
- **query**: SQL to run (string)
|
28
28
|
- If **query** is not set,
|
29
29
|
- **table**: destination table name (string, required)
|
30
|
+
- **transaction_isolation_level**: transaction isolation level (e.g. `NOLOCK`). The value is used as table hint (e.g. `SELECT * FROM SOME_TABLE with (NOLOCK)`). (string, optional)
|
30
31
|
- **select**: expression of select (e.g. `id, created_at`) (string, default: "*")
|
31
32
|
- **where**: WHERE condition to filter the rows (string, default: no-condition)
|
32
33
|
- **order_by**: expression of ORDER BY to sort rows (e.g. `created_at DESC, id ASC`) (string, default: not sorted)
|
Binary file
|
Binary file
|
@@ -11,9 +11,14 @@ import org.embulk.config.ConfigDefault;
|
|
11
11
|
import org.embulk.config.ConfigException;
|
12
12
|
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
13
13
|
import org.embulk.input.jdbc.JdbcInputConnection;
|
14
|
+
import org.embulk.input.jdbc.getter.ColumnGetterFactory;
|
14
15
|
import org.embulk.input.sqlserver.SQLServerInputConnection;
|
15
16
|
|
16
17
|
import com.google.common.base.Optional;
|
18
|
+
import org.embulk.input.sqlserver.getter.SQLServerColumnGetterFactory;
|
19
|
+
import org.embulk.spi.PageBuilder;
|
20
|
+
import org.joda.time.DateTimeZone;
|
21
|
+
|
17
22
|
import static java.util.Locale.ENGLISH;
|
18
23
|
|
19
24
|
public class SQLServerInputPlugin
|
@@ -64,6 +69,10 @@ public class SQLServerInputPlugin
|
|
64
69
|
@ConfigDefault("null")
|
65
70
|
public Optional<String> getSchema();
|
66
71
|
|
72
|
+
@Config("transaction_isolation_level")
|
73
|
+
@ConfigDefault("null")
|
74
|
+
public Optional<String> getTransactionIsolationLevel();
|
75
|
+
|
67
76
|
@Config("application_name")
|
68
77
|
@ConfigDefault("\"embulk-input-sqlserver\"")
|
69
78
|
@Size(max=128)
|
@@ -134,7 +143,8 @@ public class SQLServerInputPlugin
|
|
134
143
|
|
135
144
|
Connection con = driver.connect(urlAndProps.getUrl(), props);
|
136
145
|
try {
|
137
|
-
SQLServerInputConnection c = new SQLServerInputConnection(con, sqlServerTask.getSchema().orNull()
|
146
|
+
SQLServerInputConnection c = new SQLServerInputConnection(con, sqlServerTask.getSchema().orNull(),
|
147
|
+
sqlServerTask.getTransactionIsolationLevel().orNull());
|
138
148
|
con = null;
|
139
149
|
return c;
|
140
150
|
}
|
@@ -145,6 +155,12 @@ public class SQLServerInputPlugin
|
|
145
155
|
}
|
146
156
|
}
|
147
157
|
|
158
|
+
@Override
|
159
|
+
protected ColumnGetterFactory newColumnGetterFactory(PageBuilder pageBuilder, DateTimeZone dateTimeZone)
|
160
|
+
{
|
161
|
+
return new SQLServerColumnGetterFactory(pageBuilder, dateTimeZone);
|
162
|
+
}
|
163
|
+
|
148
164
|
private UrlAndProperties buildUrlAndProperties(SQLServerPluginTask sqlServerTask, boolean useJtdsDriver)
|
149
165
|
{
|
150
166
|
Properties props = new Properties();
|
@@ -6,11 +6,20 @@ import org.embulk.input.jdbc.JdbcInputConnection;
|
|
6
6
|
|
7
7
|
public class SQLServerInputConnection extends JdbcInputConnection {
|
8
8
|
|
9
|
+
private String transactionIsolationLevel;
|
10
|
+
|
9
11
|
public SQLServerInputConnection(Connection connection, String schemaName) throws SQLException
|
10
12
|
{
|
11
13
|
super(connection, schemaName);
|
12
14
|
}
|
13
15
|
|
16
|
+
public SQLServerInputConnection(Connection connection, String schemaName, String transactionIsolationLevel)
|
17
|
+
throws SQLException
|
18
|
+
{
|
19
|
+
super(connection, schemaName);
|
20
|
+
this.transactionIsolationLevel = transactionIsolationLevel;
|
21
|
+
}
|
22
|
+
|
14
23
|
@Override
|
15
24
|
protected void setSearchPath(String schema) throws SQLException
|
16
25
|
{
|
@@ -25,6 +34,9 @@ public class SQLServerInputConnection extends JdbcInputConnection {
|
|
25
34
|
sb.append(quoteIdentifierString(schemaName)).append(".");
|
26
35
|
}
|
27
36
|
sb.append(quoteIdentifierString(tableName));
|
37
|
+
if (transactionIsolationLevel != null) {
|
38
|
+
sb.append(" with (" + transactionIsolationLevel + ")");
|
39
|
+
}
|
28
40
|
return sb.toString();
|
29
41
|
}
|
30
42
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
package org.embulk.input.sqlserver.getter;
|
2
|
+
|
3
|
+
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
4
|
+
import org.embulk.input.jdbc.JdbcColumn;
|
5
|
+
import org.embulk.input.jdbc.JdbcColumnOption;
|
6
|
+
import org.embulk.input.jdbc.JdbcInputConnection;
|
7
|
+
import org.embulk.input.jdbc.getter.*;
|
8
|
+
import org.embulk.spi.PageBuilder;
|
9
|
+
import org.joda.time.DateTimeZone;
|
10
|
+
|
11
|
+
public class SQLServerColumnGetterFactory extends ColumnGetterFactory {
|
12
|
+
|
13
|
+
public SQLServerColumnGetterFactory(PageBuilder to, DateTimeZone defaultTimeZone)
|
14
|
+
{
|
15
|
+
super(to, defaultTimeZone);
|
16
|
+
}
|
17
|
+
|
18
|
+
@Override
|
19
|
+
public ColumnGetter newColumnGetter(JdbcInputConnection con, AbstractJdbcInputPlugin.PluginTask task, JdbcColumn column, JdbcColumnOption option)
|
20
|
+
{
|
21
|
+
ColumnGetter getter = super.newColumnGetter(con, task, column, option);
|
22
|
+
switch (column.getTypeName()) {
|
23
|
+
case "datetime":
|
24
|
+
return new TimestampWithoutTimeZoneIncrementalHandler(getter);
|
25
|
+
default:
|
26
|
+
return getter;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-sqlserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
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
|
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,12 +19,13 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- build.gradle
|
22
|
-
- classpath/embulk-input-jdbc-0.9.
|
23
|
-
- classpath/embulk-input-sqlserver-0.9.
|
22
|
+
- classpath/embulk-input-jdbc-0.9.2.jar
|
23
|
+
- classpath/embulk-input-sqlserver-0.9.2.jar
|
24
24
|
- classpath/jtds-1.3.1.jar
|
25
25
|
- lib/embulk/input/sqlserver.rb
|
26
26
|
- src/main/java/org/embulk/input/SQLServerInputPlugin.java
|
27
27
|
- src/main/java/org/embulk/input/sqlserver/SQLServerInputConnection.java
|
28
|
+
- src/main/java/org/embulk/input/sqlserver/getter/SQLServerColumnGetterFactory.java
|
28
29
|
- src/test/java/org/embulk/input/sqlserver/BasicTest.java
|
29
30
|
- src/test/java/org/embulk/input/sqlserver/SQLServerTests.java
|
30
31
|
- src/test/resources/org/embulk/input/sqlserver/test/expect/basic/setup.sql
|
Binary file
|