Skip to content

Commit

Permalink
Remove query box, truncate step (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj authored and heavycrystal committed Mar 13, 2024
1 parent 1c6f78a commit 870d2b5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 29 deletions.
3 changes: 2 additions & 1 deletion flow/connectors/postgres/qrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ func (c *PostgresConnector) SetupQRepMetadataTables(ctx context.Context, config
c.logger.Info("Setup metadata table.")

if config.WriteMode != nil &&
config.WriteMode.WriteType == protos.QRepWriteType_QREP_WRITE_MODE_OVERWRITE {
config.WriteMode.WriteType == protos.QRepWriteType_QREP_WRITE_MODE_OVERWRITE &&
config.SourcePeer.Type != protos.DBType_SNOWFLAKE {
_, err = c.conn.Exec(ctx,
"TRUNCATE TABLE "+config.DestinationTableIdentifier)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions ui/app/mirrors/create/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export const handleCreateQRep = async (
}

if (config.sourcePeer?.snowflakeConfig) {
config.query = 'SELECT * FROM ' + config.watermarkTable;
if (config.watermarkTable == '') {
notify('Please fill in the source table');
return;
Expand Down
2 changes: 1 addition & 1 deletion ui/app/mirrors/create/helpers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ export const blankSnowflakeQRepSetting = {
} as QRepWriteMode,
stagingPath: '',
numRowsPerPartition: 100000,
setupWatermarkTableOnDestination: false,
setupWatermarkTableOnDestination: true,
initialCopyOnly: true,
};
2 changes: 1 addition & 1 deletion ui/app/mirrors/create/helpers/qrep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const qrepSettings: MirrorSetting[] = [
stateHandler: (value, setter) =>
setter((curr: QRepConfig) => ({
...curr,
setupWatermarkTableOnDestination: (value as boolean) || false,
setupWatermarkTableOnDestination: (value as boolean) || true,
})),
tips: 'Specify if you want to create the watermark table on the destination as-is, can be used for some queries.',
type: 'switch',
Expand Down
11 changes: 0 additions & 11 deletions ui/app/mirrors/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ export default function CreateMirrors() {
.then((res) => {
setPeers(res);
});

if (mirrorType === 'Query Replication' || mirrorType === 'XMIN') {
if (mirrorType === 'XMIN') {
setConfig((curr) => {
return { ...curr, setupWatermarkTableOnDestination: true };
});
} else
setConfig((curr) => {
return { ...curr, setupWatermarkTableOnDestination: false };
});
}
}, [mirrorType]);

let listMirrorsPage = () => {
Expand Down
15 changes: 0 additions & 15 deletions ui/app/mirrors/create/qrep/snowflakeQrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { MirrorSetter } from '../../types';
import { fetchAllTables } from '../handlers';
import { MirrorSetting, blankSnowflakeQRepSetting } from '../helpers/common';
import { snowflakeQRepSettings } from '../helpers/qrep';
import QRepQuery from './query';

interface SnowflakeQRepProps {
mirrorConfig: QRepConfig;
Expand Down Expand Up @@ -82,20 +81,6 @@ export default function SnowflakeQRepForm({
}, [setter]);
return (
<>
<Label>
Snowflake to PostgreSQL Query Replication currently only supports
full-table streaming replication with overwrite mode. More features
coming soon!
</Label>
<QRepQuery
query={mirrorConfig.query}
setter={(val: string) => {
setter((curr) => ({
...curr,
query: val,
}));
}}
/>
{mirrorConfig.sourcePeer?.name ? (
snowflakeQRepSettings.map((setting, id) => {
return (
Expand Down

0 comments on commit 870d2b5

Please sign in to comment.