My Hours
My Hours 源连接器
支持这些引擎
Spark
Flink
SeaTunnel Zeta
关键特性
描述
用于从 My Hours 读取数据。
支持的数据源信息
为了使用 My Hours 连接器,需要以下依赖项。 可以通过 install-plugin.sh 或从 Maven 中央存储库下载。
| 数据源 | 支持的版本 | 依赖 |
|---|---|---|
| My Hours | universal | 下载 |
源选项
| 参数名 | 类型 | 必须 | 默认值 | 描述 |
|---|---|---|---|---|
| url | String | 是 | - | HTTP 请求 URL |
| String | 是 | - | My Hours 登录电子邮件地址 | |
| password | String | 是 | - | My Hours 登录密码 |
| schema | Config | 否 | - | HTTP 和 SeaTunnel 数据结构映射 |
| schema.fields | Config | 否 | - | 上游数据的模式字段 |
| json_field | Config | 否 | - | 此参数帮助您配置模式,因此此参数必须与 schema 一起使用。 |
| content_json | String | 否 | - | 此参数可以获取一些 JSON 数据。 |
| format | String | 否 | json | 上游数据的格式,现在仅支持 json text,默认 json。 |
| method | String | 否 | get | HTTP 请求方法,仅支持 GET、POST 方法。 |
| headers | Map | 否 | - | HTTP 请求头 |
| params | Map | 否 | - | HTTP 参数 |
| body | String | 否 | - | HTTP 请求体 |
| poll_interval_millis | Int | 否 | - | 流模式下请求 HTTP API 的间隔(毫秒) |
| retry | Int | 否 | - | 如果 HTTP 请求返回 IOException 的最大重试次数 |
| retry_backoff_multiplier_ms | Int | 否 | 100 | HTTP 请求失败时的重试退避倍数(毫秒) |
| retry_backoff_max_ms | Int | 否 | 10000 | HTTP 请求失败时的最大重试退避时间(毫秒) |
| enable_multi_lines | Boolean | 否 | false | 是否启用多行模式 |
| common-options | 否 | - | 源插件通用参数 |
如何创建 My Hours 数据同步作业
env {
parallelism = 1
job.mode = "BATCH"
}
source {
MyHours{
url = "https://api2.myhours.com/api/Projects/getAll"
email = "seatunnel@test.com"
password = "seatunnel"
schema {
fields {
name = string
archived = boolean
dateArchived = string
dateCreated = string
clientName = string
budgetAlertPercent = string
budgetType = int
totalTimeLogged = double
budgetValue = double
totalAmount = double
totalExpense = double
laborCost = double
totalCost = double
billableTimeLogged = double
totalBillableAmount = double
billable = boolean
roundType = int
roundInterval = int
budgetSpentPercentage = double
budgetTarget = int
budgetPeriodType = string
budgetSpent = string
id = string
}
}
}
}
# 控制台打印读取的数据
sink {
Console {
parallelism = 1
}
}
参数解释
format
当您指定格式为 json 时,您还应该指定 schema 选项。
content_json
此参数可以获取一些 JSON 数据。如果您只需要 'book' 部分中的数据,配置 content_field = "$.store.book.*"。
json_field
此参数帮助您配置模式,因此此参数必须与 schema 一起使用。
变更日志
Change Log
| Change | Commit | Version |
|---|---|---|
| [Feature][connector-http] Parameters support placeholder replacement (#9184) | https://github.com/apache/seatunnel/commit/8617014edc | 2.3.11 |
| [improve] http connector options (#8969) | https://github.com/apache/seatunnel/commit/63ff9f910a | 2.3.10 |
| [Fix][connector-http] fix when post have param (#8434) | https://github.com/apache/seatunnel/commit/c1b2675ab0 | 2.3.10 |
| [Improve][dist]add shade check rule (#8136) | https://github.com/apache/seatunnel/commit/51ef800016 | 2.3.9 |
| [Feature][Connector-V2] Support TableSourceFactory/TableSinkFactory on http (#5816) | https://github.com/apache/seatunnel/commit/6f49ec6ead | 2.3.4 |
| [Improve][build] Give the maven module a human readable name (#4114) | https://github.com/apache/seatunnel/commit/d7cd601051 | 2.3.1 |
| [Improve][Project] Code format with spotless plugin. (#4101) | https://github.com/apache/seatunnel/commit/a2ab166561 | 2.3.1 |
| [Improve][Connector-V2][Http]Improve json parse option rule for all http connector (#3627) | https://github.com/apache/seatunnel/commit/589e4161ec | 2.3.0 |
| [Feature][Connector-V2][HTTP] Use json-path parsing (#3510) | https://github.com/apache/seatunnel/commit/1807eb6c95 | 2.3.0 |
| [Hotfix][OptionRule] Fix option rule about all connectors (#3592) | https://github.com/apache/seatunnel/commit/226dc6a119 | 2.3.0 |
| [Improve][Connector-V2][MyHours]Unified exception for MyHours connector (#3538) | https://github.com/apache/seatunnel/commit/48ab7c97d5 | 2.3.0 |
| [HotFix][Core][API] Fix OptionValidation error code (#3439) | https://github.com/apache/seatunnel/commit/ace219f376 | 2.3.0 |
| [Improve][Connector-V2][My Hours]Add http method enum && Improve My Hours connector option rule (#3390) | https://github.com/apache/seatunnel/commit/a86c9d90f7 | 2.3.0 |
| [Feature][Connector-V2][Http] Add option rules && Improve Myhours sink connector (#3351) | https://github.com/apache/seatunnel/commit/cc8bb60c83 | 2.3.0 |
| [Feature][Connector-V2][My Hours] Add My Hours Source Connector (#3228) | https://github.com/apache/seatunnel/commit/4104a3e30e | 2.3.0 |