Skip to content

Commit

Permalink
Merge pull request #1217 from oom-ai/chore/fmt-sprintf
Browse files Browse the repository at this point in the history
chore: replace %s with %q
  • Loading branch information
lianxmfor authored Feb 28, 2022
2 parents 6200c7b + dc7b48e commit d7a4256
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions internal/database/offline/bigquery/table_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import (
"fmt"

"cloud.google.com/go/bigquery"
"github.com/spf13/cast"
"google.golang.org/api/iterator"

"github.com/oom-ai/oomstore/internal/database/dbutil"
"github.com/oom-ai/oomstore/internal/database/offline"
"github.com/oom-ai/oomstore/pkg/errdefs"
"github.com/oom-ai/oomstore/pkg/oomstore/types"
"github.com/spf13/cast"
"google.golang.org/api/iterator"
)

func (db *DB) TableSchema(ctx context.Context, opt offline.TableSchemaOpt) (*types.DataTableSchema, error) {
q := fmt.Sprintf(`SELECT column_name, data_type FROM %s.INFORMATION_SCHEMA.COLUMNS WHERE table_name = "%s"`, db.datasetID, opt.TableName)
q := fmt.Sprintf(`SELECT column_name, data_type FROM %s.INFORMATION_SCHEMA.COLUMNS WHERE table_name = %q`, db.datasetID, opt.TableName)
rows, err := db.Query(q).Read(ctx)
if err != nil {
return nil, errdefs.WithStack(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/database/online/cassandra/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func buildInsertStatement(tableName string, columns []string) string {
valueFlags = append(valueFlags, "?")
}

return fmt.Sprintf(`INSERT INTO "%s" (%s) VALUES (%s)`,
return fmt.Sprintf(`INSERT INTO %q (%s) VALUES (%s)`,
tableName,
dbutil.QuoteFn(Backend)(columns...),
strings.Join(valueFlags, ","))
Expand Down

0 comments on commit d7a4256

Please sign in to comment.