Skip to content

Instantly share code, notes, and snippets.

@tonyyang-svail
Created February 7, 2019 19:29
Show Gist options
  • Save tonyyang-svail/70cd0e7da963e782d3e739ac3dbb31f6 to your computer and use it in GitHub Desktop.
Save tonyyang-svail/70cd0e7da963e782d3e739ac3dbb31f6 to your computer and use it in GitHub Desktop.
syntax = "proto3";
import "google/protobuf/any.proto";
package server;
service SQLFlow {
rpc Query (Request) returns (stream RowSet);
rpc Execute (Request) returns (stream Messages);
}
// SQL statements to run
// e.g.
// 1. `SELECT ...`
// 2. `USE ...`, `DELETE ...`
// 3. `SELECT ... TRAIN/PREDICT ...`
message Request {
string sql = 1; // The SQL statement to be executed.
}
// SQL statements like `SELECT ...`, `DESCRIBE ...` returns a rowset.
// The rowset might be big. In such cases, Query returns a stream
// of RunResponse
message RowSet {
repeated string column_names = 1;
repeated Row rows = 2;
// A row of data. Data can be any type
message Row {
repeated google.protobuf.Any data = 1;
}
}
// SQL statements like `USE database`, `DELETE` returns only a success
// message.
//
// SQL statement like `SELECT ... TRAIN/PREDICT ...` returns a stream of
// messages which indicates the training/predicting progress
message Messages {
repeated string messages = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment