Skip to content

Commit

Permalink
Merge pull request #1171 from estuary/mysql-batch-query-template
Browse files Browse the repository at this point in the history
Modified default query template to find non null cursor
  • Loading branch information
jonwihl authored Jan 12, 2024
2 parents 0f4bad1 + 0cd5cdf commit b9a13a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SELECT * FROM `test`.`foobar`;
SELECT * FROM `test`.`foobar` ORDER BY `ka`;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SELECT * FROM `test`.`foobar`;
SELECT * FROM `test`.`foobar` ORDER BY `ka`, `kb`, `kc`;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SELECT * FROM `test`.`foobar`;
SELECT * FROM `test`.`foobar` ORDER BY `ka`, `kb`;
7 changes: 3 additions & 4 deletions source-mysql-batch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const tableQueryTemplateTemplate = `{{/*****************************************
***********************************************************/ -}}
{{if .CursorFields -}}
{{- if .IsFirstQuery -}}
SELECT * FROM %[1]s;
SELECT * FROM %[1]s
{{- else -}}
SELECT * FROM %[1]s
{{- range $i, $k := $.CursorFields -}}
Expand All @@ -135,9 +135,8 @@ const tableQueryTemplateTemplate = `{{/*****************************************
{{- end -}}
{{$k}} > @flow_cursor_value[{{$i}}]
{{- end -}}
) ORDER BY {{range $i, $k := $.CursorFields}}{{if gt $i 0}}, {{end}}{{$k}}{{end -}}
;
{{- end -}}
)
{{- end}} ORDER BY {{range $i, $k := $.CursorFields}}{{if gt $i 0}}, {{end}}{{$k}}{{end -}};
{{- else -}}
SELECT * FROM %[1]s;
{{- end}}`
Expand Down

0 comments on commit b9a13a7

Please sign in to comment.