Skip to content

DATA-4220: Update Go SDK + CLI to have enable backfill argument for CreateDataPipeline #5084

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion app/data_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,8 @@ func (d *DataClient) GetDataPipeline(ctx context.Context, id string) (*DataPipel

// CreateDataPipeline creates a new data pipeline using the given query and schedule.
func (d *DataClient) CreateDataPipeline(
ctx context.Context, organizationID, name string, query []map[string]interface{}, schedule string, opts *CreateDataPipelineOptions,
ctx context.Context, organizationID, name string, query []map[string]interface{}, schedule string,
enableBackfill bool, opts *CreateDataPipelineOptions,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this to the create pipeline options? To avoid this being a breaking change or do we want to for users to set it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enablebackfill is required, so i feel like it would be misleading to put it under options

) (string, error) {
mqlBinary, err := queryBSONToBinary(query)
if err != nil {
Expand All @@ -1369,6 +1370,7 @@ func (d *DataClient) CreateDataPipeline(
MqlBinary: mqlBinary,
Schedule: schedule,
DataSourceType: &dataSourceType,
EnableBackfill: &enableBackfill,
})
if err != nil {
return "", err
Expand Down
3 changes: 2 additions & 1 deletion app/data_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ func TestDataPipelineClient(t *testing.T) {
test.That(t, in.Name, test.ShouldEqual, name)
test.That(t, in.MqlBinary, test.ShouldResemble, mqlBinary)
test.That(t, in.Schedule, test.ShouldEqual, "0 9 * * *")
test.That(t, *in.EnableBackfill, test.ShouldBeTrue)
test.That(t, *in.DataSourceType, test.ShouldEqual, pb.TabularDataSourceType_TABULAR_DATA_SOURCE_TYPE_STANDARD)
return &datapipelinesPb.CreateDataPipelineResponse{
Id: "new-data-pipeline-id",
Expand All @@ -1152,7 +1153,7 @@ func TestDataPipelineClient(t *testing.T) {
options := &CreateDataPipelineOptions{
TabularDataSourceType: TabularDataSourceTypeStandard,
}
resp, err := client.CreateDataPipeline(context.Background(), organizationID, name, mqlQueries, "0 9 * * *", options)
resp, err := client.CreateDataPipeline(context.Background(), organizationID, name, mqlQueries, "0 9 * * *", true, options)
test.That(t, err, test.ShouldBeNil)
test.That(t, resp, test.ShouldEqual, "new-data-pipeline-id")
})
Expand Down
8 changes: 7 additions & 1 deletion cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const (
datapipelineFlagMQL = "mql"
datapipelineFlagMQLFile = "mql-path"
datapipelineFlagDataSourceType = "data-source-type"
datapipelineFlagEnableBackfill = "enable-backfill"

packageFlagFramework = "model-framework"

Expand Down Expand Up @@ -1626,7 +1627,7 @@ var app = &cli.App{
Name: "create",
Usage: "create a new data pipeline",
UsageText: createUsageText("datapipelines create",
[]string{generalFlagOrgID, generalFlagName, datapipelineFlagSchedule}, false, false,
[]string{generalFlagOrgID, generalFlagName, datapipelineFlagSchedule, datapipelineFlagEnableBackfill}, false, false,
fmt.Sprintf("[--%s=<%s> | --%s=<%s>]",
datapipelineFlagMQL, datapipelineFlagMQL,
datapipelineFlagMQLFile, datapipelineFlagMQLFile),
Expand Down Expand Up @@ -1655,6 +1656,11 @@ var app = &cli.App{
Name: datapipelineFlagMQLFile,
Usage: "path to JSON file containing MQL query for the new data pipeline",
},
&cli.BoolFlag{
Name: datapipelineFlagEnableBackfill,
Usage: "enable data pipeline to run over organization's historical data",
Required: true,
},
&cli.StringFlag{
Name: datapipelineFlagDataSourceType,
Usage: formatAcceptedValues(
Expand Down
Loading