Skip to content

Commit

Permalink
Merge branch 'dev' into doris_streamload_sink
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoZex authored Dec 11, 2022
2 parents 6b7ae70 + 80cf8f4 commit 4894727
Show file tree
Hide file tree
Showing 44 changed files with 1,735 additions and 46 deletions.
12 changes: 9 additions & 3 deletions docs/en/connector-v2/sink/Jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
Write data through jdbc. Support Batch mode and Streaming mode, support concurrent writing, support exactly-once
semantics (using XA transaction guarantee).

:::tip

Warn: for license compliance, you have to provide database driver yourself, copy to `$SEATNUNNEL_HOME/plugins/jdbc/lib/` directory in order to make them work.

e.g. If you use MySQL, should download and copy `mysql-connector-java-xxx.jar` to `$SEATNUNNEL_HOME/plugins/jdbc/lib/`

:::

## Key features

- [x] [exactly-once](../../concept/connector-v2-features.md)
Expand Down Expand Up @@ -40,9 +48,7 @@ support `Xa transactions`. You can set `is_exactly_once=true` to enable it.

### driver [string]

The jdbc class name used to connect to the remote data source, if you use MySQL the value is com.mysql.cj.jdbc.Driver.
Warn: for license compliance, you have to provide any driver yourself like MySQL JDBC Driver, e.g. copy mysql-connector-java-xxx.jar to
$SEATNUNNEL_HOME/lib for Standalone.
The jdbc class name used to connect to the remote data source, if you use MySQL the value is `com.mysql.cj.jdbc.Driver`.

### user [string]

Expand Down
79 changes: 79 additions & 0 deletions docs/en/connector-v2/sink/Maxcompute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Maxcompute

> Maxcompute sink connector
## Description

Used to read data from Maxcompute.

## Key features

- [ ] [exactly-once](../../concept/connector-v2-features.md)
- [ ] [schema projection](../../concept/connector-v2-features.md)

## Options

| name | type | required | default value |
|-------------------|----------|-----------|---------------|
| accessId | string | yes | - |
| accesskey | string | yes | - |
| endpoint | string | yes | - |
| project | string | yes | - |
| table_name | string | yes | - |
| partition_spec | string | no | - |
| overwrite | boolean | no | false |
| common-options | string | no | |

### accessId [string]

`accessId` Your Maxcompute accessId which cloud be access from Alibaba Cloud.

### accesskey [string]

`accesskey` Your Maxcompute accessKey which cloud be access from Alibaba Cloud.

### endpoint [string]

`endpoint` Your Maxcompute endpoint start with http.

### project [string]

`project` Your Maxcompute project which is created in Alibaba Cloud.

### table_name [string]

`table_name` Target Maxcompute table name eg: fake.

### partition_spec [string]

`partition_spec` This spec of Maxcompute partition table eg:ds='20220101'.

### overwrite [boolean]

`overwrite` Whether to overwrite the table or partition, default: false.

### common options

Sink plugin common parameters, please refer to [Sink Common Options](common-options.md) for details.

## Examples

```hocon
sink {
Maxcompute {
accessId="<your access id>"
accesskey="<your access Key>"
endpoint="<http://service.odps.aliyun.com/api>"
project="<your project>"
table_name="<your table name>"
#partition_spec="<your partition spec>"
#overwrite = false
}
}
```

## Changelog

### next version

- [Feature] Add Maxcompute Sink Connector([3640](https://github.com/apache/incubator-seatunnel/pull/3640))
11 changes: 6 additions & 5 deletions docs/en/connector-v2/sink/S3File.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ By default, we use 2PC commit to ensure `exactly-once`
|----------------------------------|---------|----------|-----------------------------------------------------------|
| path | string | yes | - |
| bucket | string | yes | - |
| access_key | string | yes | - |
| access_secret | string | yes | - |
| access_key | string | no | - |
| access_secret | string | no | - |
| hadoop_s3_properties | map | no | - |
| file_name_expression | string | no | "${transactionId}" |
| file_format | string | no | "text" |
Expand All @@ -56,11 +56,11 @@ The bucket address of s3 file system, for example: `s3n://seatunnel-test`, if yo

### access_key [string]

The access key of s3 file system.
The access key of s3 file system. If this parameter is not set, please confirm that the credential provider chain can be authenticated correctly, you could check this [hadoop-aws](https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/index.html)

### access_secret [string]

The access secret of s3 file system.
The access secret of s3 file system. If this parameter is not set, please confirm that the credential provider chain can be authenticated correctly, you could check this [hadoop-aws](https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/index.html)

### hadoop_s3_properties [map]

Expand Down Expand Up @@ -235,4 +235,5 @@ For orc file format
- Allow user to add additional hadoop-s3 parameters
- Allow the use of the s3a protocol
- Decouple hadoop-aws dependencies
- [Improve] Support setting batch size for every file ([3625](https://github.com/apache/incubator-seatunnel/pull/3625))
- [Improve] Support setting batch size for every file ([3625](https://github.com/apache/incubator-seatunnel/pull/3625))
- [Feature]Set S3 AK to optional ([3688](https://github.com/apache/incubator-seatunnel/pull/))
12 changes: 9 additions & 3 deletions docs/en/connector-v2/source/Jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

Read external data source data through JDBC.

:::tip

Warn: for license compliance, you have to provide database driver yourself, copy to `$SEATNUNNEL_HOME/plugins/jdbc/lib/` directory in order to make them work.

e.g. If you use MySQL, should download and copy `mysql-connector-java-xxx.jar` to `$SEATNUNNEL_HOME/plugins/jdbc/lib/`

:::

## Key features

- [x] [batch](../../concept/connector-v2-features.md)
Expand Down Expand Up @@ -38,9 +46,7 @@ supports query SQL and can achieve projection effect.

### driver [string]

The jdbc class name used to connect to the remote data source, if you use MySQL the value is com.mysql.cj.jdbc.Driver.
Warn: for license compliance, you have to provide MySQL JDBC driver yourself, e.g. copy mysql-connector-java-xxx.jar to
$SEATNUNNEL_HOME/lib for Standalone.
The jdbc class name used to connect to the remote data source, if you use MySQL the value is `com.mysql.cj.jdbc.Driver`.

### user [string]

Expand Down
82 changes: 82 additions & 0 deletions docs/en/connector-v2/source/Maxcompute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Maxcompute

> Maxcompute source connector
## Description

Used to read data from Maxcompute.

## Key features

- [x] [batch](../../concept/connector-v2-features.md)
- [ ] [exactly-once](../../concept/connector-v2-features.md)
- [ ] [schema projection](../../concept/connector-v2-features.md)
- [x] [parallelism](../../concept/connector-v2-features.md)
- [ ] [support user-defined split](../../concept/connector-v2-features.md)

## Options

| name | type | required | default value |
|-----------------|--------|-----------|---------------|
| accessId | string | yes | - |
| accesskey | string | yes | - |
| endpoint | string | yes | - |
| project | string | yes | - |
| table_name | string | yes | - |
| partition_spec | string | no | - |
| split_row | int | no | 10000 |
| common-options | string | no | |

### accessId [string]

`accessId` Your Maxcompute accessId which cloud be access from Alibaba Cloud.

### accesskey [string]

`accesskey` Your Maxcompute accessKey which cloud be access from Alibaba Cloud.

### endpoint [string]

`endpoint` Your Maxcompute endpoint start with http.

### project [string]

`project` Your Maxcompute project which is created in Alibaba Cloud.

### table_name [string]

`table_name` Target Maxcompute table name eg: fake.

### partition_spec [string]

`partition_spec` This spec of Maxcompute partition table eg:ds='20220101'.

### split_row [int]

`split_row` Number of rows per split, default: 10000.

### common options

Source plugin common parameters, please refer to [Source Common Options](common-options.md) for details.

## Examples

```hocon
source {
Maxcompute {
accessId="<your access id>"
accesskey="<your access Key>"
endpoint="<http://service.odps.aliyun.com/api>"
project="<your project>"
table_name="<your table name>"
#partition_spec="<your partition spec>"
#split_row = 10000
}
}
```

## Changelog

### next version

- [Feature] Add Maxcompute Source Connector([3640](https://github.com/apache/incubator-seatunnel/pull/3640))
9 changes: 5 additions & 4 deletions docs/en/connector-v2/source/S3File.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Read all the data in a split in a pollNext call. What splits are read will be sa
| path | string | yes | - |
| type | string | yes | - |
| bucket | string | yes | - |
| access_key | string | yes | - |
| access_secret | string | yes | - |
| access_key | string | no | - |
| access_secret | string | no | - |
| hadoop_s3_properties | map | no | - |
| delimiter | string | no | \001 |
| parse_partition_from_path | boolean | no | true |
Expand Down Expand Up @@ -188,11 +188,11 @@ The bucket address of s3 file system, for example: `s3n://seatunnel-test`, if yo

### access_key [string]

The access key of s3 file system.
The access key of s3 file system. If this parameter is not set, please confirm that the credential provider chain can be authenticated correctly, you could check this [hadoop-aws](https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/index.html)

### access_secret [string]

The access secret of s3 file system.
The access secret of s3 file system. If this parameter is not set, please confirm that the credential provider chain can be authenticated correctly, you could check this [hadoop-aws](https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/index.html)

### hadoop_s3_properties [map]

Expand Down Expand Up @@ -262,3 +262,4 @@ Source plugin common parameters, please refer to [Source Common Options](common-
- Allow user to add additional hadoop-s3 parameters
- Allow the use of the s3a protocol
- Decouple hadoop-aws dependencies
- [Feature]Set S3 AK to optional ([3688](https://github.com/apache/incubator-seatunnel/pull/))
2 changes: 2 additions & 0 deletions plugin-mapping.properties
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,6 @@ seatunnel.sink.RabbitMQ = connector-rabbitmq
seatunnel.source.RabbitMQ = connector-rabbitmq
seatunnel.source.OpenMldb = connector-openmldb
seatunnel.sink.Doris = connector-doris
seatunnel.source.Maxcompute = connector-maxcompute
seatunnel.sink.Maxcompute = connector-maxcompute
seatunnel.source.MySQL-CDC = connector-cdc-mysql
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public String toJsonString() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
try {
return objectMapper.writeValueAsString(this.metrics);
return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(this.metrics);
} catch (JsonProcessingException e) {
ObjectNode objectNode = objectMapper.createObjectNode();
objectNode.put("err", "serialize JobMetrics err");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private String switchHdfsImpl() {
}

private static void putS3SK(Map<String, String> s3Options, Config config) {
if (!CheckConfigUtil.isValidParam(config, S3Config.S3_ACCESS_KEY.key()) && CheckConfigUtil.isValidParam(config, S3Config.S3_SECRET_KEY.key())) {
return;
}
String accessKey = config.getString(S3Config.S3_ACCESS_KEY.key());
String secretKey = config.getString(S3Config.S3_SECRET_KEY.key());
if (S3A_SCHEMA.equals(SCHEMA)) {
Expand All @@ -83,4 +86,5 @@ private static void putS3SK(Map<String, String> s3Options, Config config) {
s3Options.put("fs.s3n.awsAccessKeyId", accessKey);
s3Options.put("fs.s3n.awsSecretAccessKey", secretKey);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public OptionRule optionRule() {
return OptionRule.builder()
.required(S3Config.FILE_PATH)
.required(S3Config.S3_BUCKET)
.required(S3Config.S3_ACCESS_KEY)
.required(S3Config.S3_SECRET_KEY)
.optional(S3Config.S3_ACCESS_KEY)
.optional(S3Config.S3_SECRET_KEY)
.optional(BaseSinkConfig.FILE_NAME_EXPRESSION)
.optional(BaseSinkConfig.FILE_FORMAT)
.optional(BaseSinkConfig.FILENAME_TIME_FORMAT)
Expand Down
61 changes: 61 additions & 0 deletions seatunnel-connectors-v2/connector-maxcompute/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>seatunnel-connectors-v2</artifactId>
<groupId>org.apache.seatunnel</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>connector-maxcompute</artifactId>

<properties>
<maxcompute.version>0.31.3</maxcompute.version>
<commons.lang3.version>3.4</commons.lang3.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>seatunnel-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-sdk-core</artifactId>
<version>${maxcompute.version}-public</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>connector-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 4894727

Please sign in to comment.