Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Changed default for `database/sql` driver from TABLE service to QUERY service

## v3.121.0
* Changed internal pprof label to pyroscope supported format
* Added `query.ImplicitTxControl()` transaction control (the same as `query.NoTx()` and `query.EmptyTxControl()`). See more about implicit transactions on [ydb.tech](https://ydb.tech/docs/en/concepts/transactions?version=v25.2#implicit)
Expand Down
8 changes: 5 additions & 3 deletions internal/xsql/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,13 @@ func Open(
balancer: balancer,
queryConfig: queryConfig,
processor: func() Engine {
if overQueryService, _ := strconv.ParseBool(os.Getenv("YDB_DATABASE_SQL_OVER_QUERY_SERVICE")); overQueryService {
return QUERY
overQueryService, err := strconv.ParseBool(os.Getenv("YDB_DATABASE_SQL_OVER_QUERY_SERVICE"))
if err == nil && !overQueryService {
return TABLE
}

return TABLE
// default is Query Engine
return QUERY
}(),
clock: clockwork.NewRealClock(),
done: make(chan struct{}),
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/database_sql_defaults_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build integration
// +build integration

package integration

import (
"database/sql"
"testing"

_ "github.com/ydb-platform/ydb-go-sdk/v3"
)

func TestDatabaseSQLDefaultProcessor(st *testing.T) {
t := newScope(st)

db, err := sql.Open("ydb", t.ConnectionString())
t.Require.NoError(err)
defer db.Close()

_, err = db.Exec("DISCARD SELECT 1")
t.Require.Error(err, "DISCARD is supported in TABLE service but not in QUERY service")
}
Loading