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

chore: refactor serialization in query service #4234

Merged
merged 1 commit into from
Jan 30, 2025
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
chore: refactor serialization in query service
  • Loading branch information
worstell committed Jan 30, 2025
commit e24057402cfb759068bc0404655456a60e9a6218
9 changes: 3 additions & 6 deletions backend/controller/sql/testdata/go/mysql/queries.ftl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

531 changes: 191 additions & 340 deletions backend/protos/xyz/block/ftl/query/v1/query.pb.go

Large diffs are not rendered by default.

21 changes: 6 additions & 15 deletions backend/protos/xyz/block/ftl/query/v1/query.proto
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
syntax = "proto3";

Check failure on line 1 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Previously present message "SQLValue" was deleted from file.

package xyz.block.ftl.query.v1;

import "google/protobuf/timestamp.proto";
import "xyz/block/ftl/v1/ftl.proto";

option go_package = "github.com/block/ftl/backend/protos/xyz/block/ftl/query/v1;querypb";
@@ -30,24 +29,16 @@
TransactionStatus status = 1;
}

// A value that can be used as a SQL parameter
message SQLValue {
oneof value {
string string_value = 1;
int64 int_value = 2;
double float_value = 3;
bool bool_value = 4;
bytes bytes_value = 5;
google.protobuf.Timestamp timestamp_value = 6;
bool null_value = 7; // Set to true to represent NULL
}
message ResultColumn {
string type_name = 1; // The name in the FTL-generated type
string sql_name = 2; // The database column name
}

message ExecuteQueryRequest {
string raw_sql = 1;
CommandType command_type = 2;
repeated SQLValue parameters = 3; // SQL parameter values in order
repeated string result_columns = 6; // Column names to scan for the result type
string parameters_json = 3; // JSON array of parameter values in order

Check failure on line 40 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "3" with name "parameters_json" on message "ExecuteQueryRequest" changed cardinality from "repeated" to "optional with implicit presence".

Check failure on line 40 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "3" with name "parameters_json" on message "ExecuteQueryRequest" changed option "json_name" from "parameters" to "parametersJson".

Check failure on line 40 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "3" with name "parameters_json" on message "ExecuteQueryRequest" changed type from "message" to "string".

Check failure on line 40 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "3" on message "ExecuteQueryRequest" changed name from "parameters" to "parameters_json".
repeated ResultColumn result_columns = 6; // Column names to scan for the result type

Check failure on line 41 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "6" with name "result_columns" on message "ExecuteQueryRequest" changed type from "string" to "message".
optional string transaction_id = 4;
optional int32 batch_size = 5; // Default 100 if not set
}
@@ -66,8 +57,8 @@
optional int64 last_insert_id = 2; // Only for some databases like MySQL
}

message RowResults {

Check failure on line 60 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Previously present message "RowResults.RowsEntry" was deleted from file.
map<string, SQLValue> rows = 1; // Each row is a map of column name to value
string json_rows = 1; // JSON object mapping column names to values

Check failure on line 61 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "1" with name "json_rows" on message "RowResults" changed cardinality from "map" to "optional with implicit presence".

Check failure on line 61 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "1" with name "json_rows" on message "RowResults" changed option "json_name" from "rows" to "jsonRows".

Check failure on line 61 in backend/protos/xyz/block/ftl/query/v1/query.proto

GitHub Actions / Proto Breaking Change Check

Field "1" with name "json_rows" on message "RowResults" changed type from "message" to "string".
bool has_more = 2; // Indicates if there are more rows to fetch
}

Loading
Loading