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

allow more than one dataset in cli #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion cmd/bigquery-emulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"os/signal"
"strings"
"syscall"

"github.com/goccy/bigquery-emulator/server"
Expand All @@ -16,7 +17,8 @@ import (

type option struct {
Project string `description:"specify the project name" long:"project"`
Dataset string `description:"specify the dataset name" long:"dataset"`
Dataset string `description:"specify the dataset name [DEPRECATED]" long:"dataset"`
Datasets string `description:"specify dataset names, separated by a comma" long:"datasets"`
HTTPPort uint16 `description:"specify the http port number. this port used by bigquery api" long:"port" default:"9050"`
GRPCPort uint16 `description:"specify the grpc port number. this port used by bigquery storage api" long:"grpc-port" default:"9060"`
LogLevel server.LogLevel `description:"specify the log level (debug/info/warn/error)" long:"log-level" default:"error"`
Expand Down Expand Up @@ -85,8 +87,13 @@ func runServer(args []string, opt option) error {
}
project := types.NewProject(opt.Project)
if opt.Dataset != "" {
fmt.Println("DeprecationWarning: the flag --dataset is deprecated. use the flag --datasets instead")
project.Datasets = append(project.Datasets, types.NewDataset(opt.Dataset))
}

for _, dataset := range strings.Split(opt.Datasets, ",") {
project.Datasets = append(project.Datasets, types.NewDataset(dataset))
}
bqServer, err := server.New(db)
if err != nil {
return err
Expand Down