Skip to content

Commit 58aa527

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Bump fivetran sdk to v2 (#34452)
Updated relevant proto items. Updated logging to use the warning/task system. Was more thorough with source connector. Destination connector is not yet shipped - so ok if that has shortcomings - we can resolve later. GitOrigin-RevId: 0a35089cc54dd42c430a11b551eab45d35605b5d
1 parent 86ae5d3 commit 58aa527

File tree

22 files changed

+265
-223
lines changed

22 files changed

+265
-223
lines changed

crates/fivetran_common/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use fxhash::FxHasher32;
1111

1212
// Make sure to select a rev off the `production` branch of the sdk
1313
// https://github.com/fivetran/fivetran_sdk/tree/production
14-
const REV: &str = "1fabb7626b6ec81a4f56d49a16a654210cb1d0be";
14+
const REV: &str = "466a61bddfc0e541bfec3cb0cc6a3cf3704d64be";
1515

1616
const FILES: &[&str] = &[
1717
"common.proto",
@@ -21,7 +21,7 @@ const FILES: &[&str] = &[
2121

2222
// File hash to protect against accidental changes to the vendored files:
2323
// Update this when updating `REV` above.
24-
const FILE_HASH: u64 = 3447879181;
24+
const FILE_HASH: u64 = 1411440539;
2525

2626
cfg_if::cfg_if! {
2727
if #[cfg(target_os = "macos")] {

crates/fivetran_common/fivetran_sdk/1fabb7626b6ec81a4f56d49a16a654210cb1d0be/LICENSE

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Fivetran Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
syntax = "proto3";
22
option optimize_for = SPEED;
33
option java_multiple_files = true;
4-
option go_package = "fivetran.com/fivetran_sdk";
5-
package fivetran_sdk;
4+
option go_package = "fivetran.com/fivetran_sdk_v2";
5+
package fivetran_sdk.v2;
66

77
import "google/protobuf/timestamp.proto";
88

@@ -18,12 +18,29 @@ message ConfigurationFormResponse {
1818
message FormField {
1919
string name = 1;
2020
string label = 2;
21-
bool required = 3;
21+
optional bool required = 3;
2222
optional string description = 4;
2323
oneof type {
2424
TextField text_field = 5;
2525
DropdownField dropdown_field = 6;
2626
ToggleField toggle_field = 7;
27+
ConditionalFields conditional_fields = 10;
28+
}
29+
optional string default_value = 8;
30+
optional string placeholder = 9;
31+
}
32+
33+
message ConditionalFields {
34+
VisibilityCondition condition = 1;
35+
repeated FormField fields = 2;
36+
}
37+
38+
message VisibilityCondition {
39+
string condition_field = 1;
40+
oneof visible_when {
41+
bool bool_value = 2;
42+
string string_value = 3;
43+
bool empty_value = 4;
2744
}
2845
}
2946

@@ -53,7 +70,6 @@ message TestResponse {
5370
oneof response {
5471
bool success = 1;
5572
string failure = 2;
56-
// potential future warning
5773
}
5874
}
5975

@@ -86,14 +102,22 @@ enum DataType {
86102
XML = 12;
87103
STRING = 13;
88104
JSON = 14;
105+
NAIVE_TIME = 15;
106+
}
107+
108+
message DataTypeParams {
109+
oneof params {
110+
DecimalParams decimal = 1;
111+
int32 string_byte_length = 2;
112+
}
89113
}
90114

91115
message DecimalParams {
92116
uint32 precision = 1;
93117
uint32 scale = 2;
94118
}
95119

96-
enum OpType {
120+
enum RecordType {
97121
UPSERT = 0;
98122
UPDATE = 1;
99123
DELETE = 2;
@@ -117,6 +141,7 @@ message ValueType {
117141
string string = 13;
118142
string json = 14;
119143
string xml = 15;
144+
google.protobuf.Timestamp naive_time = 16;
120145
}
121146
}
122147

@@ -129,5 +154,13 @@ message Column {
129154
string name = 1;
130155
DataType type = 2;
131156
bool primary_key = 3;
132-
optional DecimalParams decimal = 4;
157+
optional DataTypeParams params = 4;
158+
}
159+
160+
message Warning {
161+
string message = 1;
162+
}
163+
164+
message Task {
165+
string message = 1;
133166
}
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
syntax = "proto3";
22
option optimize_for = SPEED;
33
option java_multiple_files = true;
4-
option go_package = "fivetran.com/fivetran_sdk";
5-
package fivetran_sdk;
4+
option go_package = "fivetran.com/fivetran_sdk_v2";
5+
package fivetran_sdk.v2;
66

77
import "common.proto";
88

9-
// Fivetran (grpc client) <> Connector (grpc server)
10-
service Connector {
9+
// Fivetran (grpc client) <> SourceConnector (grpc server)
10+
service SourceConnector {
1111
rpc ConfigurationForm (ConfigurationFormRequest) returns (ConfigurationFormResponse) {}
1212
rpc Test (TestRequest) returns (TestResponse) {}
1313
rpc Schema (SchemaRequest) returns (SchemaResponse) {}
@@ -65,28 +65,12 @@ message TableSelection {
6565
}
6666

6767
message UpdateResponse {
68-
oneof response {
69-
LogEntry log_entry = 1;
70-
Operation operation = 2;
71-
}
72-
}
73-
74-
enum LogLevel {
75-
INFO = 0;
76-
WARNING = 1;
77-
SEVERE = 2;
78-
}
79-
80-
message LogEntry {
81-
LogLevel level = 1;
82-
string message = 2;
83-
}
84-
85-
message Operation {
86-
oneof op {
68+
oneof operation {
8769
Record record = 1;
8870
SchemaChange schema_change = 2;
8971
Checkpoint checkpoint = 3;
72+
Warning warning = 4;
73+
Task task = 5;
9074
}
9175
}
9276

@@ -100,7 +84,7 @@ message SchemaChange {
10084
message Record {
10185
optional string schema_name = 1;
10286
string table_name = 2;
103-
OpType type = 3;
87+
RecordType type = 3;
10488
map<string, ValueType> data = 4;
10589
}
10690

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
syntax = "proto3";
22
option optimize_for = SPEED;
33
option java_multiple_files = true;
4-
option go_package = "fivetran.com/fivetran_sdk";
5-
package fivetran_sdk;
4+
option go_package = "fivetran.com/fivetran_sdk_v2";
5+
package fivetran_sdk.v2;
66

77
import "google/protobuf/timestamp.proto";
88
import "common.proto";
99

10-
// Fivetran (grpc client) <> Destination (grpc server)
11-
service Destination {
10+
// Fivetran (grpc client) <> DestinationConnector (grpc server)
11+
service DestinationConnector {
1212
rpc ConfigurationForm (ConfigurationFormRequest) returns (ConfigurationFormResponse) {}
13+
rpc Capabilities (CapabilitiesRequest) returns (CapabilitiesResponse) {}
1314
rpc Test (TestRequest) returns (TestResponse) {}
1415
rpc DescribeTable (DescribeTableRequest) returns (DescribeTableResponse) {}
1516
rpc CreateTable(CreateTableRequest) returns (CreateTableResponse) {}
1617
rpc AlterTable(AlterTableRequest) returns (AlterTableResponse) {}
1718
rpc Truncate(TruncateRequest) returns (TruncateResponse) {}
1819
rpc WriteBatch (WriteBatchRequest) returns (WriteBatchResponse) {}
20+
rpc WriteHistoryBatch (WriteHistoryBatchRequest) returns (WriteBatchResponse) {}
21+
}
22+
23+
message CapabilitiesRequest {}
24+
25+
message CapabilitiesResponse {
26+
BatchFileFormat batch_file_format = 1;
1927
}
2028

2129
message DescribeTableRequest {
@@ -27,8 +35,9 @@ message DescribeTableRequest {
2735
message DescribeTableResponse {
2836
oneof response {
2937
bool not_found = 1;
30-
string failure = 2;
31-
Table table = 3;
38+
Table table = 2;
39+
Warning warning = 3;
40+
Task task = 4;
3241
}
3342
}
3443

@@ -41,7 +50,8 @@ message CreateTableRequest {
4150
message CreateTableResponse {
4251
oneof response {
4352
bool success = 1;
44-
string failure = 2;
53+
Warning warning = 2;
54+
Task task = 3;
4555
}
4656
}
4757

@@ -54,7 +64,8 @@ message AlterTableRequest {
5464
message AlterTableResponse {
5565
oneof response {
5666
bool success = 1;
57-
string failure = 2;
67+
Warning warning = 2;
68+
Task task = 3;
5869
}
5970
}
6071

@@ -68,13 +79,14 @@ message TruncateRequest {
6879
}
6980

7081
message SoftTruncate {
71-
string deleted_column = 3;
82+
string deleted_column = 1;
7283
}
7384

7485
message TruncateResponse {
7586
oneof response {
7687
bool success = 1;
77-
string failure = 2;
88+
Warning warning = 2;
89+
Task task = 3;
7890
}
7991
}
8092

@@ -86,12 +98,22 @@ message WriteBatchRequest {
8698
repeated string replace_files = 5;
8799
repeated string update_files = 6;
88100
repeated string delete_files = 7;
89-
oneof file_params {
90-
CsvFileParams csv = 8;
91-
}
101+
FileParams file_params = 8;
102+
}
103+
104+
message WriteHistoryBatchRequest {
105+
map<string, string> configuration = 1;
106+
string schema_name = 2;
107+
Table table = 3;
108+
map<string, bytes> keys = 4;
109+
repeated string earliest_start_files = 5;
110+
repeated string replace_files = 6;
111+
repeated string update_files = 7;
112+
repeated string delete_files = 8;
113+
FileParams file_params = 9;
92114
}
93115

94-
message CsvFileParams {
116+
message FileParams {
95117
Compression compression = 1;
96118
Encryption encryption = 2;
97119
string null_string = 3;
@@ -103,6 +125,11 @@ enum Encryption {
103125
AES = 1;
104126
}
105127

128+
enum BatchFileFormat {
129+
CSV = 0;
130+
PARQUET = 1;
131+
}
132+
106133
enum Compression {
107134
OFF = 0;
108135
ZSTD = 1;
@@ -112,6 +139,7 @@ enum Compression {
112139
message WriteBatchResponse {
113140
oneof response {
114141
bool success = 1;
115-
string failure = 2;
142+
Warning warning = 2;
143+
Task task = 3;
116144
}
117145
}

crates/fivetran_common/fivetran_sdk/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ This folder is a mirror of https://github.com/fivetran/fivetran_sdk at a pinned
22
revision. Vendoring this source lets us avoid depending on the network during
33
our builds.
44

5-
When upgrading, be sure to select a rev off the `production` branch of the sdk
6-
https://github.com/fivetran/fivetran_sdk/tree/production
5+
When upgrading, be sure to select a rev off the `production` or `v2` tag of the
6+
sdk :
7+
8+
- https://github.com/fivetran/fivetran_sdk/tree/production
9+
- https://github.com/fivetran/fivetran_sdk/tree/v2

crates/fivetran_common/src/config.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,28 @@ impl Config {
3333
FormField {
3434
name: CONFIG_KEY_DEPLOYMENT_URL.to_string(),
3535
label: "Deployment URL".to_string(),
36-
required: true,
36+
required: Some(true),
3737
description: Some(
38-
"The domain where the deployment is hosted (\"https://….convex.cloud\"). You \
39-
can find it in the deployment settings page of the Convex dashboard."
38+
"The domain where the deployment is hosted. You can find it in the deployment \
39+
settings page of the Convex dashboard."
4040
.to_string(),
4141
),
4242
r#type: Some(Type::TextField(TextField::PlainText as i32)),
43+
default_value: None,
44+
placeholder: Some("https://aware-llama-900.convex.cloud".to_string()),
4345
},
4446
FormField {
4547
name: CONFIG_KEY_DEPLOYMENT_KEY.to_string(),
4648
label: "Deploy Key".to_string(),
47-
required: true,
49+
required: Some(true),
4850
description: Some(
4951
"The key giving access to your deployment. You can find it in the deployment \
5052
settings page of the Convex dashboard."
5153
.to_string(),
5254
),
5355
r#type: Some(Type::TextField(TextField::Password as i32)),
56+
default_value: None,
57+
placeholder: None,
5458
},
5559
]
5660
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#![allow(clippy::enum_variant_names)]
2-
tonic::include_proto!("fivetran_sdk");
2+
tonic::include_proto!("fivetran_sdk.v2");

0 commit comments

Comments
 (0)