From c2037630f30b04c687214eadaf4f57c1fb528d69 Mon Sep 17 00:00:00 2001 From: "emrah.diril" Date: Thu, 11 Apr 2024 00:22:09 +0300 Subject: [PATCH] Changes to interfaces --- common.proto | 30 +++++++++++++++++++--- connector_sdk.proto | 26 +++---------------- destination_sdk.proto | 59 +++++++++++++++++++++++++++++++++++++------ 3 files changed, 81 insertions(+), 34 deletions(-) diff --git a/common.proto b/common.proto index 4af9061..e917787 100644 --- a/common.proto +++ b/common.proto @@ -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; } } @@ -94,7 +116,7 @@ message DecimalParams { uint32 scale = 2; } -enum OpType { +enum RecordType { UPSERT = 0; UPDATE = 1; DELETE = 2; diff --git a/connector_sdk.proto b/connector_sdk.proto index 60f4ee4..019a8f5 100644 --- a/connector_sdk.proto +++ b/connector_sdk.proto @@ -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) {} @@ -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; @@ -100,7 +82,7 @@ message SchemaChange { message Record { optional string schema_name = 1; string table_name = 2; - OpType type = 3; + RecordType type = 3; map data = 4; } diff --git a/destination_sdk.proto b/destination_sdk.proto index d928f43..c8e6c88 100644 --- a/destination_sdk.proto +++ b/destination_sdk.proto @@ -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) {} @@ -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 configuration = 1; string schema_name = 2; @@ -48,7 +72,25 @@ message CreateTableResponse { message AlterTableRequest { map 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 { @@ -82,12 +124,13 @@ message WriteBatchRequest { map configuration = 1; string schema_name = 2; Table table = 3; - map keys = 4; - repeated string replace_files = 5; - repeated string update_files = 6; - repeated string delete_files = 7; + bool history_mode = 4; + map 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; } }