Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add statement to query result (#6813)

Danny Xu8e3aac760836
diff --git a/backend/plugin/db/clickhouse/clickhouse.go b/backend/plugin/db/clickhouse/clickhouse.go
index f6c88c5edf..1b463e77ab 100644
--- a/backend/plugin/db/clickhouse/clickhouse.go
+++ b/backend/plugin/db/clickhouse/clickhouse.go
@@ -180,12 +180,15 @@ func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement strin
}
defer rows.Close()
- result, err := convertRowsToQueryResult(rows, startTime)
+ result, err := convertRowsToQueryResult(rows)
if err != nil {
result = &v1pb.QueryResult{
Error: err.Error(),
}
}
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = strings.TrimRight(statement, " \n\t;")
+
results = append(results, result)
return nil
}); err != nil {
@@ -220,8 +223,9 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, statement str
startTime := time.Now()
statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
- statement = getStatementWithResultLimit(statement, queryContext.Limit)
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getStatementWithResultLimit(stmt, queryContext.Limit)
}
// Clickhouse doesn't support READ ONLY transactions (Error: sql: driver does not support read-only transactions).
@@ -235,16 +239,23 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, statement str
}
defer tx.Rollback()
- rows, err := tx.QueryContext(ctx, statement)
+ rows, err := tx.QueryContext(ctx, stmt)
if err != nil {
- return nil, util.FormatErrorWithQuery(err, statement)
+ return nil, util.FormatErrorWithQuery(err, stmt)
}
defer rows.Close()
- return convertRowsToQueryResult(rows, startTime)
+ result, err := convertRowsToQueryResult(rows)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+
+ return result, err
}
-func convertRowsToQueryResult(rows *sql.Rows, startTime time.Time) (*v1pb.QueryResult, error) {
+func convertRowsToQueryResult(rows *sql.Rows) (*v1pb.QueryResult, error) {
columnNames, err := rows.Columns()
if err != nil {
return nil, err
@@ -275,7 +286,6 @@ func convertRowsToQueryResult(rows *sql.Rows, startTime time.Time) (*v1pb.QueryR
ColumnNames: columnNames,
ColumnTypeNames: columnTypeNames,
Rows: data,
- Latency: durationpb.New(time.Since(startTime)),
}, nil
}
diff --git a/backend/plugin/db/mongodb/mongodb.go b/backend/plugin/db/mongodb/mongodb.go
index 4ed1622f7f..ac302ce07d 100644
--- a/backend/plugin/db/mongodb/mongodb.go
+++ b/backend/plugin/db/mongodb/mongodb.go
@@ -250,6 +250,7 @@ func (driver *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement str
ColumnTypeNames: types,
Rows: rows,
Latency: durationpb.New(time.Since(startTime)),
+ Statement: statement,
}}, nil
}
diff --git a/backend/plugin/db/mssql/mssql.go b/backend/plugin/db/mssql/mssql.go
index f59eef1a52..728ec5d399 100644
--- a/backend/plugin/db/mssql/mssql.go
+++ b/backend/plugin/db/mssql/mssql.go
@@ -7,10 +7,12 @@ import (
"fmt"
"net/url"
"strings"
+ "time"
// Import go-ora Oracle driver.
_ "github.com/microsoft/go-mssqldb"
_ "github.com/microsoft/go-mssqldb/integratedauth/krb5"
+ "google.golang.org/protobuf/types/known/durationpb"
"go.uber.org/zap"
@@ -157,18 +159,25 @@ func (driver *Driver) QueryConn2(ctx context.Context, conn *sql.Conn, statement
}
func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- statement := singleSQL.Text
- statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
- statement = getMSSQLStatementWithResultLimit(statement, queryContext.Limit)
+ statement := strings.TrimRight(singleSQL.Text, " \n\t;")
+
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getMSSQLStatementWithResultLimit(stmt, queryContext.Limit)
}
if queryContext.ReadOnly {
// MSSQL does not support transaction isolation level for read-only queries.
queryContext.ReadOnly = false
}
-
- return util.Query2(ctx, db.MSSQL, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, db.MSSQL, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement.
diff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.go
index 7b8769b1e5..81f55fe9e9 100644
--- a/backend/plugin/db/mysql/mysql.go
+++ b/backend/plugin/db/mysql/mysql.go
@@ -14,6 +14,7 @@ import (
"go.uber.org/multierr"
"go.uber.org/zap"
"golang.org/x/crypto/ssh"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
@@ -261,9 +262,11 @@ func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, single
return nil, nil
}
statement := strings.TrimRight(singleSQL.Text, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
+
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
var err error
- statement, err = driver.getStatementWithResultLimit(statement, queryContext.Limit)
+ stmt, err = driver.getStatementWithResultLimit(stmt, queryContext.Limit)
if err != nil {
return nil, err
}
@@ -275,7 +278,14 @@ func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, single
queryContext.ReadOnly = false
}
- return util.Query2(ctx, driver.dbType, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, driver.dbType, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement in a given connection.
diff --git a/backend/plugin/db/oracle/oracle.go b/backend/plugin/db/oracle/oracle.go
index 537bacd0a1..0ff25247eb 100644
--- a/backend/plugin/db/oracle/oracle.go
+++ b/backend/plugin/db/oracle/oracle.go
@@ -7,11 +7,13 @@ import (
"fmt"
"strconv"
"strings"
+ "time"
// Import go-ora Oracle driver.
"github.com/pkg/errors"
go_ora "github.com/sijms/go-ora/v2"
"go.uber.org/zap"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -163,10 +165,11 @@ func getOracleStatementWithResultLimit(stmt string, limit int) string {
}
func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- statement := singleSQL.Text
- statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(strings.ToUpper(statement), "EXPLAIN") && queryContext.Limit > 0 {
- statement = getOracleStatementWithResultLimit(statement, queryContext.Limit)
+ statement := strings.TrimRight(singleSQL.Text, " \n\t;")
+
+ stmt := statement
+ if !strings.HasPrefix(strings.ToUpper(stmt), "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getOracleStatementWithResultLimit(stmt, queryContext.Limit)
}
if queryContext.ReadOnly {
@@ -174,7 +177,14 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL par
queryContext.ReadOnly = false
}
- return util.Query2(ctx, db.Oracle, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, db.Oracle, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement in a given connection.
diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.go
index 10b317a238..3b71424045 100644
--- a/backend/plugin/db/pg/pg.go
+++ b/backend/plugin/db/pg/pg.go
@@ -18,6 +18,7 @@ import (
"go.uber.org/multierr"
"go.uber.org/zap"
"golang.org/x/crypto/ssh"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
@@ -493,13 +494,21 @@ func getStatementWithResultLimit(stmt string, limit int) string {
}
func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- statement := singleSQL.Text
- statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
- statement = getStatementWithResultLimit(statement, queryContext.Limit)
+ statement := strings.TrimRight(singleSQL.Text, " \n\t;")
+
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getStatementWithResultLimit(stmt, queryContext.Limit)
}
- return util.Query2(ctx, db.Postgres, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, db.Postgres, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement in a given connection.
diff --git a/backend/plugin/db/redis/redis.go b/backend/plugin/db/redis/redis.go
index 7f26d1adc7..f1bcd3b341 100644
--- a/backend/plugin/db/redis/redis.go
+++ b/backend/plugin/db/redis/redis.go
@@ -275,6 +275,7 @@ func (d *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement string,
ColumnTypeNames: []string{"TEXT"},
Rows: data,
Latency: durationpb.New(time.Since(startTime)),
+ Statement: statement,
}}, nil
}
diff --git a/backend/plugin/db/redshift/redshift.go b/backend/plugin/db/redshift/redshift.go
index 8abca9f977..3e71704508 100644
--- a/backend/plugin/db/redshift/redshift.go
+++ b/backend/plugin/db/redshift/redshift.go
@@ -16,6 +16,7 @@ import (
"go.uber.org/multierr"
"go.uber.org/zap"
"golang.org/x/crypto/ssh"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -401,10 +402,11 @@ func getStatementWithResultLimit(stmt string, limit int) string {
}
func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- statement := singleSQL.Text
- statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
- statement = getStatementWithResultLimit(statement, queryContext.Limit)
+ statement := strings.TrimRight(singleSQL.Text, " \n\t;")
+
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getStatementWithResultLimit(stmt, queryContext.Limit)
}
// Datashare doesn't support read-only transactions.
if driver.datashare {
@@ -412,7 +414,14 @@ func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, single
queryContext.ShareDB = true
}
- return util.Query2(ctx, db.Redshift, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, db.Redshift, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement in a given connection.
diff --git a/backend/plugin/db/snowflake/snowflake.go b/backend/plugin/db/snowflake/snowflake.go
index 0cb45098ce..bdf9d39fa8 100644
--- a/backend/plugin/db/snowflake/snowflake.go
+++ b/backend/plugin/db/snowflake/snowflake.go
@@ -6,8 +6,10 @@ import (
"database/sql"
"fmt"
"strings"
+ "time"
"github.com/pkg/errors"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
@@ -280,10 +282,11 @@ func getStatementWithResultLimit(stmt string, limit int) string {
}
func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- statement := singleSQL.Text
- statement = strings.TrimRight(statement, " \n\t;")
- if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {
- statement = getStatementWithResultLimit(statement, queryContext.Limit)
+ statement := strings.TrimRight(singleSQL.Text, " \n\t;")
+
+ stmt := statement
+ if !strings.HasPrefix(stmt, "EXPLAIN") && queryContext.Limit > 0 {
+ stmt = getStatementWithResultLimit(stmt, queryContext.Limit)
}
// Snowflake doesn't support READ ONLY transactions.
@@ -292,7 +295,14 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL par
queryContext.ReadOnly = false
}
- return util.Query2(ctx, db.Snowflake, conn, statement, queryContext)
+ startTime := time.Now()
+ result, err := util.Query2(ctx, db.Snowflake, conn, stmt, queryContext)
+ if err != nil {
+ return nil, err
+ }
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = statement
+ return result, nil
}
// RunStatement runs a SQL statement in a given connection.
diff --git a/backend/plugin/db/spanner/spanner.go b/backend/plugin/db/spanner/spanner.go
index 421f09cb47..bd14bd9239 100644
--- a/backend/plugin/db/spanner/spanner.go
+++ b/backend/plugin/db/spanner/spanner.go
@@ -567,6 +567,7 @@ func (d *Driver) querySingleSQL(ctx context.Context, statement string) (*v1pb.Qu
Rows: data,
Masked: sensitiveInfo,
Latency: durationpb.New(time.Since(startTime)),
+ Statement: statement,
}, nil
}
@@ -657,6 +658,7 @@ func (d *Driver) RunStatement(ctx context.Context, _ *sql.Conn, statement string
ColumnTypeNames: types,
Rows: rows,
Latency: durationpb.New(time.Since(startTime)),
+ Statement: statement,
})
}
diff --git a/backend/plugin/db/sqlite/sqlite.go b/backend/plugin/db/sqlite/sqlite.go
index 19b95c494a..aa0ccc101b 100644
--- a/backend/plugin/db/sqlite/sqlite.go
+++ b/backend/plugin/db/sqlite/sqlite.go
@@ -8,11 +8,13 @@ import (
"os"
"path"
"strings"
+ "time"
// Import sqlite3 driver.
_ "github.com/mattn/go-sqlite3"
"github.com/pkg/errors"
"go.uber.org/zap"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -159,10 +161,13 @@ func (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string,
// QueryConn2 queries a SQL statement in a given connection.
func (*Driver) QueryConn2(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]*v1pb.QueryResult, error) {
+ startTime := time.Now()
result, err := util.Query2(ctx, db.SQLite, conn, statement, queryContext)
if err != nil {
return nil, err
}
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = strings.TrimRight(statement, " \n\t;")
return []*v1pb.QueryResult{result}, nil
}
diff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.go
index a6d85b1a9d..5e60e34c64 100644
--- a/backend/plugin/db/util/driverutil.go
+++ b/backend/plugin/db/util/driverutil.go
@@ -218,7 +218,6 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string
// Query2 will execute a readonly / SELECT query.
// TODO(rebelice): remove Query function and rename Query2 to Query after frontend is ready to use the new API.
func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
- startTime := time.Now()
tx, err := conn.BeginTx(ctx, &sql.TxOptions{ReadOnly: queryContext.ReadOnly})
if err != nil {
return nil, err
@@ -283,7 +282,6 @@ func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement strin
ColumnTypeNames: columnTypeNames,
Rows: data,
Masked: fieldMaskInfo,
- Latency: durationpb.New(time.Since(startTime)),
}, nil
}
@@ -331,6 +329,7 @@ func RunStatement(ctx context.Context, engineType parser.EngineType, conn *sql.C
ColumnTypeNames: types,
Rows: rows,
Latency: durationpb.New(time.Since(startTime)),
+ Statement: strings.TrimRight(singleSQL.Text, " \n\t;"),
})
continue
}
@@ -350,16 +349,18 @@ func adminQuery(ctx context.Context, conn *sql.Conn, statement string) *v1pb.Que
}
defer rows.Close()
- result, err := rowsToQueryResult(rows, startTime)
+ result, err := rowsToQueryResult(rows)
if err != nil {
return &v1pb.QueryResult{
Error: err.Error(),
}
}
+ result.Latency = durationpb.New(time.Since(startTime))
+ result.Statement = strings.TrimRight(statement, " \n\t;")
return result
}
-func rowsToQueryResult(rows *sql.Rows, startTime time.Time) (*v1pb.QueryResult, error) {
+func rowsToQueryResult(rows *sql.Rows) (*v1pb.QueryResult, error) {
columnNames, err := rows.Columns()
if err != nil {
return nil, err
@@ -390,7 +391,6 @@ func rowsToQueryResult(rows *sql.Rows, startTime time.Time) (*v1pb.QueryResult,
ColumnNames: columnNames,
ColumnTypeNames: columnTypeNames,
Rows: data,
- Latency: durationpb.New(time.Since(startTime)),
}, nil
}
diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.go
index c49f5722be..05d12cbd40 100644
--- a/backend/tests/schema_update_test.go
+++ b/backend/tests/schema_update_test.go
@@ -56,6 +56,7 @@ var (
},
},
},
+ Statement: "SELECT * FROM book",
}
)
diff --git a/backend/tests/sensitive_data_test.go b/backend/tests/sensitive_data_test.go
index f270bf8ce1..5fcb5ea411 100644
--- a/backend/tests/sensitive_data_test.go
+++ b/backend/tests/sensitive_data_test.go
@@ -49,6 +49,7 @@ var (
},
},
},
+ Statement: "SELECT * FROM tech_book",
}
originData = &v1pb.QueryResult{
ColumnNames: []string{"id", "name", "author"},
@@ -76,6 +77,7 @@ var (
},
},
},
+ Statement: "SELECT * FROM tech_book",
}
)
diff --git a/backend/tests/sql_editor_test.go b/backend/tests/sql_editor_test.go
index 5cfe948dc1..c4af131c05 100644
--- a/backend/tests/sql_editor_test.go
+++ b/backend/tests/sql_editor_test.go
@@ -46,6 +46,7 @@ func TestAdminQueryAffectedRows(t *testing.T) {
},
},
},
+ Statement: "INSERT INTO tbl VALUES(1)",
},
},
},
@@ -65,6 +66,7 @@ func TestAdminQueryAffectedRows(t *testing.T) {
},
},
},
+ Statement: "INSERT INTO tbl VALUES(1)",
},
{
ColumnNames: []string{"Affected Rows"},
@@ -76,6 +78,7 @@ func TestAdminQueryAffectedRows(t *testing.T) {
},
},
},
+ Statement: "DELETE FROM tbl WHERE id = 1",
},
},
},
@@ -95,6 +98,7 @@ func TestAdminQueryAffectedRows(t *testing.T) {
},
},
},
+ Statement: "INSERT INTO tbl VALUES(1),(2)",
},
},
},
@@ -104,7 +108,9 @@ func TestAdminQueryAffectedRows(t *testing.T) {
prepareStatements: "CREATE TABLE tbl(id INT PRIMARY KEY);",
query: "ALTER TABLE tbl ADD COLUMN name VARCHAR(255);",
affectedRows: []*v1pb.QueryResult{
- {},
+ {
+ Statement: "ALTER TABLE tbl ADD COLUMN name VARCHAR(255)",
+ },
},
},
}
diff --git a/backend/tests/sql_review_test.go b/backend/tests/sql_review_test.go
index ee6ea3462d..ca5014f7f9 100644
--- a/backend/tests/sql_review_test.go
+++ b/backend/tests/sql_review_test.go
@@ -274,6 +274,7 @@ func TestSQLReviewForMySQL(t *testing.T) {
},
},
},
+ Statement: "SELECT count(*) FROM test WHERE 1=1",
}
)
diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.ts
index aa2d47cf03..4509324195 100644
--- a/frontend/src/types/proto/v1/sql_service.ts
+++ b/frontend/src/types/proto/v1/sql_service.ts
@@ -136,6 +136,8 @@ export interface QueryResult {
error: string;
/** The time it takes to execute the query. */
latency?: Duration;
+ /** The query statement for the result. */
+ statement: string;
}
export interface QueryRow {
@@ -740,7 +742,7 @@ export const QueryResponse = {
};
function createBaseQueryResult(): QueryResult {
- return { columnNames: [], columnTypeNames: [], rows: [], masked: [], error: "", latency: undefined };
+ return { columnNames: [], columnTypeNames: [], rows: [], masked: [], error: "", latency: undefined, statement: "" };
}
export const QueryResult = {
@@ -765,6 +767,9 @@ export const QueryResult = {
if (message.latency !== undefined) {
Duration.encode(message.latency, writer.uint32(50).fork()).ldelim();
}
+ if (message.statement !== "") {
+ writer.uint32(58).string(message.statement);
+ }
return writer;
},
@@ -827,6 +832,13 @@ export const QueryResult = {
message.latency = Duration.decode(reader, reader.uint32());
continue;
+ case 7:
+ if (tag !== 58) {
+ break;
+ }
+
+ message.statement = reader.string();
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -844,6 +856,7 @@ export const QueryResult = {
masked: Array.isArray(object?.masked) ? object.masked.map((e: any) => Boolean(e)) : [],
error: isSet(object.error) ? String(object.error) : "",
latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined,
+ statement: isSet(object.statement) ? String(object.statement) : "",
};
},
@@ -871,6 +884,7 @@ export const QueryResult = {
}
message.error !== undefined && (obj.error = message.error);
message.latency !== undefined && (obj.latency = message.latency ? Duration.toJSON(message.latency) : undefined);
+ message.statement !== undefined && (obj.statement = message.statement);
return obj;
},
@@ -888,6 +902,7 @@ export const QueryResult = {
message.latency = (object.latency !== undefined && object.latency !== null)
? Duration.fromPartial(object.latency)
: undefined;
+ message.statement = object.statement ?? "";
return message;
},
};
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a5bec92078..caa029a4cf 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -8100,6 +8100,7 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr
| masked | [bool](#bool) | repeated | Columns are masked or not. |
| error | [string](#string) | | The error message if the query failed. |
| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The time it takes to execute the query. |
+| statement | [string](#string) | | The query statement for the result. |
diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.go
index 9550a370c9..a8f56a34fe 100644
--- a/proto/generated-go/v1/sql_service.pb.go
+++ b/proto/generated-go/v1/sql_service.pb.go
@@ -539,6 +539,8 @@ type QueryResult struct {
Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
// The time it takes to execute the query.
Latency *durationpb.Duration `protobuf:"bytes,6,opt,name=latency,proto3" json:"latency,omitempty"`
+ // The query statement for the result.
+ Statement string `protobuf:"bytes,7,opt,name=statement,proto3" json:"statement,omitempty"`
}
func (x *QueryResult) Reset() {
@@ -615,6 +617,13 @@ func (x *QueryResult) GetLatency() *durationpb.Duration {
return nil
}
+func (x *QueryResult) GetStatement() string {
+ if x != nil {
+ return x.Statement
+ }
+ return ""
+}
+
type QueryRow struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -1149,7 +1158,7 @@ var file_v1_sql_service_proto_rawDesc = []byte{
0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2d,
0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64,
- 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0xea, 0x01,
+ 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x88, 0x02,
0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a,
0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73,
@@ -1164,99 +1173,101 @@ var file_v1_sql_service_proto_rawDesc = []byte{
0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79,
0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
- 0x6e, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x22, 0x39, 0x0a, 0x08, 0x51, 0x75,
- 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73,
- 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xcb, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c,
- 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c,
- 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,
- 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65,
- 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
- 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61,
- 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61,
- 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75,
- 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61,
- 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52,
- 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69,
- 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05,
- 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21,
- 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20,
- 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75,
- 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75,
- 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e,
- 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32,
- 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0b,
- 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75,
- 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28,
- 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65,
- 0x12, 0x39, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
- 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52,
- 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b,
- 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32,
- 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76,
- 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
- 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18,
- 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07,
- 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63,
- 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05,
- 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65,
- 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61,
- 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12,
- 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
- 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10,
- 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09,
- 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72,
- 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65,
- 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79,
- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65,
- 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72,
- 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x6e, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74,
+ 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
+ 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x39, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72,
+ 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x73, 0x22, 0xcb, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a,
+ 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21,
+ 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75,
+ 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c,
+ 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x0a, 0x66,
+ 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74,
+ 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00,
+ 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b,
+ 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
+ 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,
+ 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
+ 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69,
+ 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e,
+ 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x48,
+ 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39,
+ 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e,
+ 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x06,
+ 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63,
+ 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
+ 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
+ 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e,
+ 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c,
+ 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54,
+ 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12,
+ 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05,
+ 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x74,
+ 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e, 0x67,
+ 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52, 0x06,
+ 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
+ 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
+ 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a,
+ 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72,
+ 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12,
0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65,
- 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
- 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74,
- 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75,
- 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d,
- 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63,
- 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65,
- 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x32, 0xb6, 0x03, 0x0a, 0x0a, 0x53,
- 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65,
- 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
- 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72,
- 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c,
- 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79,
- 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51,
- 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79,
- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a,
- 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e,
- 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79,
- 0x12, 0x6b, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
- 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x74, 0x0a,
- 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x20, 0x2e,
+ 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
+ 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x32, 0xb6, 0x03, 0x0a, 0x0a, 0x53, 0x51, 0x4c,
+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74, 0x74,
+ 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74,
+ 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93,
+ 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70,
+ 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65,
+ 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a,
+ 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74,
+ 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x6b,
+ 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76,
+ 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
+ 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x74, 0x0a, 0x0c, 0x41,
+ 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45,
+ 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e,
0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69,
- 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64,
- 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f,
- 0x76, 0x31, 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x28,
- 0x01, 0x30, 0x01, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,
- 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31,
+ 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x28, 0x01, 0x30,
+ 0x01, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67,
+ 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.proto
index ff56ae797d..739c438394 100644
--- a/proto/v1/sql_service.proto
+++ b/proto/v1/sql_service.proto
@@ -133,6 +133,9 @@ message QueryResult {
// The time it takes to execute the query.
google.protobuf.Duration latency = 6;
+
+ // The query statement for the result.
+ string statement = 7;
}
message QueryRow {