Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor list_tables #2130

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dozer-cli/src/live/server.rs
Original file line number Diff line number Diff line change
@@ -9,12 +9,13 @@ use dozer_types::{
},
contract::{
contract_service_server::{ContractService, ContractServiceServer},
CommonRequest, DotResponse, ProtoResponse, SchemasResponse, SourcesRequest,
CommonRequest, DotResponse, ProtoResponse, SourcesRequest,
},
live::{
code_service_server::{CodeService, CodeServiceServer},
ConnectResponse, Label, Labels, RunRequest,
},
types::SchemasResponse,
},
log::info,
};
3 changes: 2 additions & 1 deletion dozer-cli/src/live/state.rs
Original file line number Diff line number Diff line change
@@ -9,8 +9,9 @@ use dozer_sql::builder::statement_to_pipeline;
use dozer_tracing::{Labels, LabelsAndProgress};
use dozer_types::{
grpc_types::{
contract::{DotResponse, ProtoResponse, SchemasResponse},
contract::{DotResponse, ProtoResponse},
live::{BuildResponse, BuildStatus, ConnectResponse, LiveApp, LiveResponse, RunRequest},
types::SchemasResponse,
},
log::info,
models::{
9 changes: 1 addition & 8 deletions dozer-cli/src/simple/build/contract/service.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ use dozer_core::{
Direction,
},
};
use dozer_types::grpc_types::{contract::Schema, conversions::field_definition_to_grpc};
use dozer_types::grpc_types::{conversions::map_schema, types::Schema};

use crate::errors::BuildError;

@@ -242,13 +242,6 @@ impl Display for UiEdgeType {

type UiGraph = daggy::Dag<UiNodeType, UiEdgeType>;

fn map_schema(schema: dozer_types::types::Schema) -> Schema {
Schema {
primary_index: schema.primary_index.into_iter().map(|i| i as i32).collect(),
fields: field_definition_to_grpc(schema.fields),
}
}

fn remove_from_processor(graph: &UiGraph) -> UiGraph {
let mut output = UiGraph::new();

17 changes: 8 additions & 9 deletions dozer-types/protos/cloud.proto
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
syntax = "proto3";
package dozer.cloud;
import "types.proto";
import "cloud_types.proto";
import "cloud_notification.proto";
import "cloud_infastructure.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
service DozerCloud {

rpc validate_connection(ConnectionRequest)
returns (ValidateConnectionResponse);
rpc create_connection(ConnectionRequest) returns (ConnectionResponse);
rpc get_connection(GetConnectionRequest) returns (ConnectionResponse);
rpc list_connections(GetAllConnectionRequest)
returns (GetAllConnectionResponse);
rpc get_tables(GetTablesRequest) returns (GetTablesResponse);
rpc list_tables(ListTablesRequest) returns (dozer.types.SchemasResponse);
rpc update_connection(UpdateConnectionRequest) returns (ConnectionResponse);

rpc list_applications(ListAppRequest) returns (ListAppResponse);
@@ -239,7 +238,7 @@ message ConnectionRequest {
message GetConnectionRequest {
string connection_id = 1;
}
message ValidateConnectionResponse { bool success = 1; }

message ConnectionResponse {
string id = 1;
string name = 2;
@@ -249,11 +248,11 @@ message Connection {
string name = 1;
string yaml_content = 3;
}
message GetTablesRequest { string connection_id = 2; }

message GetTablesResponse {
string connection_id = 1;
repeated TableInfo tables = 2;
message ListTablesRequest {
oneof criteria {
string connection_id = 1;
string yaml = 2;
}
}

message GetAllConnectionRequest {
17 changes: 3 additions & 14 deletions dozer-types/protos/contract.proto
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ package dozer.contract;
import "types.proto";

service ContractService {
rpc Sources(SourcesRequest) returns (SchemasResponse);
rpc Endpoints(CommonRequest) returns (SchemasResponse);
rpc Sources(SourcesRequest) returns (dozer.types.SchemasResponse);
rpc Endpoints(CommonRequest) returns (dozer.types.SchemasResponse);
rpc GenerateDot(CommonRequest) returns (DotResponse);
rpc GetGraphSchemas(CommonRequest) returns (SchemasResponse);
rpc GetGraphSchemas(CommonRequest) returns (dozer.types.SchemasResponse);
rpc GetProtos(CommonRequest) returns (ProtoResponse);
}

@@ -28,17 +28,6 @@ message CommonRequest {
optional CloudVersionId cloud_id = 1;
}

message SchemasResponse {
map<string, Schema> schemas = 1;
}

message Schema {
// The list of indexes of the keys that are used as the primary index.
repeated int32 primary_index = 1;
// The list of field definitions.
repeated dozer.types.FieldDefinition fields = 2;
}

message DotResponse {
string dot = 1;
}
10 changes: 10 additions & 0 deletions dozer-types/protos/types.proto
Original file line number Diff line number Diff line change
@@ -134,3 +134,13 @@ message Value {
google.protobuf.Value json_value = 14; // JSON type.
};
}
message SchemasResponse {
map<string, Schema> schemas = 1;
}

message Schema {
// The list of indexes of the keys that are used as the primary index.
repeated int32 primary_index = 1;
// The list of field definitions.
repeated FieldDefinition fields = 2;
}
6 changes: 6 additions & 0 deletions dozer-types/src/grpc_types.rs
Original file line number Diff line number Diff line change
@@ -193,4 +193,10 @@ pub mod conversions {
FieldType::Duration => Type::Duration,
}
}
pub fn map_schema(schema: crate::types::Schema) -> crate::grpc_types::types::Schema {
crate::grpc_types::types::Schema {
primary_index: schema.primary_index.into_iter().map(|i| i as i32).collect(),
fields: field_definition_to_grpc(schema.fields),
}
}
}