Skip to content

Commit

Permalink
check for start and end existence
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Apr 29, 2024
1 parent 63bf892 commit 55eb84b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ui/app/mirrors/create/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ export const handleCreateQRep = async (
return;
}

if (
config.writeMode?.writeType != QRepWriteType.QREP_WRITE_MODE_OVERWRITE &&
!(query.includes('{{.start}}') && query.includes('{{.end}}'))
) {
notifyErr(
'Please include placeholders {{.start}} and {{.end}} in the query'
);
return;
}

if (xmin == true) {
config.watermarkColumn = 'xmin';
config.query = `SELECT * FROM ${quotedWatermarkTable(
Expand Down
5 changes: 5 additions & 0 deletions ui/app/mirrors/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ export default function CreateMirrors() {
Write a query whose results will be replicated to a target
table.
<br></br>
For append and upsert modes, make sure the query{' '}
<b>includes the start and end placeholders</b> in the query.
PeerDB uses these placeholders for partitioning query results
for performance.
<br></br>
In most cases, you will require a watermark table and a
watermark column in that table.
<br></br>
Expand Down

0 comments on commit 55eb84b

Please sign in to comment.