Skip to content

Commit

Permalink
Changes to interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ediril authored and manjutapali committed Jun 18, 2024
1 parent 4247c73 commit aa705cc
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 34 deletions.
30 changes: 26 additions & 4 deletions common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,36 @@ message ConfigurationFormResponse {
}

message FormField {
oneof field {
Field single = 1;
FieldSet field_set = 2;
}
}

message Field {
string name = 1;
string label = 2;
bool required = 3;
optional string description = 4;
optional string default_value = 5;
optional string placeholder = 6;
oneof type {
TextField text_field = 5;
DropdownField dropdown_field = 6;
ToggleField toggle_field = 7;
TextField text_field = 7;
DropdownField dropdown_field = 8;
ToggleField toggle_field = 9;
}
}

message FieldSet {
repeated FormField fields = 1;
optional VisibilityCondition condition = 2;
}

message VisibilityCondition {
string field_name = 1;
oneof condition {
bool has_bool_value = 2;
string has_string_value = 3;
}
}

Expand Down Expand Up @@ -94,7 +116,7 @@ message DecimalParams {
uint32 scale = 2;
}

enum OpType {
enum RecordType {
UPSERT = 0;
UPDATE = 1;
DELETE = 2;
Expand Down
26 changes: 4 additions & 22 deletions connector_sdk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package fivetran_sdk;

import "common.proto";

// Fivetran (grpc client) <> Connector (grpc server)
service Connector {
// Fivetran (grpc client) <> SourceConnector (grpc server)
service SourceConnector {
rpc ConfigurationForm (ConfigurationFormRequest) returns (ConfigurationFormResponse) {}
rpc Test (TestRequest) returns (TestResponse) {}
rpc Schema (SchemaRequest) returns (SchemaResponse) {}
Expand Down Expand Up @@ -65,25 +65,7 @@ message TableSelection {
}

message UpdateResponse {
oneof response {
LogEntry log_entry = 1;
Operation operation = 2;
}
}

enum LogLevel {
INFO = 0;
WARNING = 1;
SEVERE = 2;
}

message LogEntry {
LogLevel level = 1;
string message = 2;
}

message Operation {
oneof op {
oneof operation {
Record record = 1;
SchemaChange schema_change = 2;
Checkpoint checkpoint = 3;
Expand All @@ -100,7 +82,7 @@ message SchemaChange {
message Record {
optional string schema_name = 1;
string table_name = 2;
OpType type = 3;
RecordType type = 3;
map<string, ValueType> data = 4;
}

Expand Down
59 changes: 51 additions & 8 deletions destination_sdk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ package fivetran_sdk;
import "google/protobuf/timestamp.proto";
import "common.proto";

// Fivetran (grpc client) <> Destination (grpc server)
service Destination {
// Fivetran (grpc client) <> DestinationConnector (grpc server)
service DestinationConnector {
rpc ConfigurationForm (ConfigurationFormRequest) returns (ConfigurationFormResponse) {}
rpc Capabilities(CapabilitiesRequest) returns (CapabilitiesResponse) {}
rpc Test (TestRequest) returns (TestResponse) {}
rpc DescribeTable (DescribeTableRequest) returns (DescribeTableResponse) {}
rpc CreateTable(CreateTableRequest) returns (CreateTableResponse) {}
Expand All @@ -18,6 +19,29 @@ service Destination {
rpc WriteBatch (WriteBatchRequest) returns (WriteBatchResponse) {}
}

message CapabilitiesRequest {}

message CapabilitiesResponse {
repeated DataTypeMappingEntry data_type_mappings = 1;
bool supports_history_mode = 2;
}

message DataTypeMappingEntry {
DataType fivetran_type = 1;
oneof destination_type {
DestinationType map_to = 2;
bool unsupported = 3;
}
}

message DestinationType {
string name = 1;
oneof mapping {
bool keep_same = 2;
DataType map_to = 3;
}
}

message DescribeTableRequest {
map<string, string> configuration = 1;
string schema_name = 2;
Expand Down Expand Up @@ -48,7 +72,25 @@ message CreateTableResponse {
message AlterTableRequest {
map<string, string> configuration = 1;
string schema_name = 2;
Table table = 3;
string table_name = 3;
repeated SchemaChange changes = 4;
}

message SchemaChange {
oneof change {
Column add_column = 1;
ChangeType change_column_type = 2;
PrimaryKey new_primary_key = 3;
}
}

message PrimaryKey {
repeated string column_name = 1;
}

message ChangeType {
string column_name = 1;
DataType new_type = 2;
}

message AlterTableResponse {
Expand Down Expand Up @@ -82,12 +124,13 @@ message WriteBatchRequest {
map<string, string> configuration = 1;
string schema_name = 2;
Table table = 3;
map<string, bytes> keys = 4;
repeated string replace_files = 5;
repeated string update_files = 6;
repeated string delete_files = 7;
bool history_mode = 4;
map<string, bytes> keys = 5;
repeated string replace_files = 6;
repeated string update_files = 7;
repeated string delete_files = 8;
oneof file_params {
CsvFileParams csv = 8;
CsvFileParams csv = 9;
}
}

Expand Down

0 comments on commit aa705cc

Please sign in to comment.