Skip to content

Commit

Permalink
squashy squash
Browse files Browse the repository at this point in the history
  • Loading branch information
mkysel committed May 30, 2024
1 parent 63fbefb commit d86f0c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions internal/impl/sql/conn_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/redpanda-data/benthos/v4/public/service"
)

var driverField = service.NewStringEnumField("driver", "mysql", "postgres", "clickhouse", "mssql", "sqlite", "oracle", "snowflake", "trino", "gocosmos").
var driverField = service.NewStringEnumField("driver", "mysql", "postgres", "clickhouse", "mssql", "sqlite", "oracle", "snowflake", "trino", "gocosmos", "flightsql").
Description("A database <<drivers, driver>> to use.")

var dsnField = service.NewStringField("dsn").
Expand All @@ -28,6 +28,9 @@ The following is a list of supported drivers, their placeholder style, and their
` + "| `clickhouse` " + `
` + "| https://github.com/ClickHouse/clickhouse-go#dsn[`clickhouse://[username[:password\\]@\\][netloc\\][:port\\]/dbname[?param1=value1&...&paramN=valueN\\]`^] " + `
` + "| `flightsql` " + `
` + "| `flightsql://[user[:password]@]<address>[:port][?param1=value1&...&paramN=valueN`" + `
` + "| `mysql` " + `
` + "| `[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]` " + `
Expand Down Expand Up @@ -61,7 +64,8 @@ The ` + "https://pkg.go.dev/github.com/microsoft/gocosmos[`gocosmos`^]" + ` driv
Example("clickhouse://username:password@host1:9000,host2:9000/database?dial_timeout=200ms&max_execution_time=60").
Example("foouser:foopassword@tcp(localhost:3306)/foodb").
Example("postgres://foouser:foopass@localhost:5432/foodb?sslmode=disable").
Example("oracle://foouser:foopass@localhost:1521/service_name")
Example("oracle://foouser:foopass@localhost:1521/service_name").
Example("flightsql://localhost:12345/foodb?token=bar")

func connFields() []*service.ConfigField {
return []*service.ConfigField{
Expand Down Expand Up @@ -124,6 +128,7 @@ func rawQueryField() *service.ConfigField {
| Driver | Placeholder Style |
|---|---|
` + "| `clickhouse` | Dollar sign |" + `
` + "| `flightsql` | Dollar sign |" + `
` + "| `mysql` | Question mark |" + `
` + "| `postgres` | Dollar sign |" + `
` + "| `mssql` | Question mark |" + `
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/sql/input_sql_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func newSQLSelectInputFromConfig(conf *service.ParsedConfig, mgr *service.Resour
}

s.builder = squirrel.Select(columns...).From(tableStr)
if s.driver == "postgres" || s.driver == "clickhouse" {
if s.driver == "postgres" || s.driver == "clickhouse" || s.driver == "flightsql" {
s.builder = s.builder.PlaceholderFormat(squirrel.Dollar)
} else if s.driver == "oracle" || s.driver == "gocosmos" {
s.builder = s.builder.PlaceholderFormat(squirrel.Colon)
Expand Down
1 change: 1 addition & 0 deletions public/components/sql/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// Import all (supported) sql drivers.
_ "github.com/ClickHouse/clickhouse-go/v2"
_ "github.com/apache/arrow/go/v14/arrow/flight/flightsql/driver"
_ "github.com/denisenkom/go-mssqldb"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
Expand Down

0 comments on commit d86f0c8

Please sign in to comment.