Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 9e0c817

Browse files
committed
removes auto magic config
1 parent 2914ae6 commit 9e0c817

File tree

1 file changed

+91
-44
lines changed

1 file changed

+91
-44
lines changed

backend/protos/mgmt/v1alpha1/job.proto

Lines changed: 91 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -598,57 +598,104 @@ message JobTypeConfig {
598598
// The strategy used to configure how columns are handled during a job run
599599
message ColumnStrategy {
600600
oneof strategy {
601-
option (buf.validate.oneof).required = false;
602-
// When this strategy is configured, all columns are mapped.
603-
// Further configuration can be done to handle columns not present in the schema mappings.
601+
// 1. Map all columns + user-defined sub-strategies for each mismatch scenario
604602
MapAllColumns map_all_columns = 1;
603+
604+
// 2. Only map user-defined columns + sub-strategies for mismatch scenarios
605+
MapDefinedColumns map_defined_columns = 2;
605606
}
606607

607-
// Strategy that maps all columns for a table.
608-
// Further configuration can be done to handle columns not present in the schema mappings.
609-
// Also strategies may be configured for handling a mapped column that is no longer present in the source.
608+
// -------------------------------------------------------------
609+
// 1. MapAllColumns
610+
// -------------------------------------------------------------
610611
message MapAllColumns {
611-
// The strategy to use when a new column is detected
612-
optional ColumnAdditionStrategy column_addition_strategy = 1;
613-
// The strategy to use when a column is removed
614-
optional ColumnRemovalStrategy column_removal_strategy = 2;
615-
616-
// Strategy to use when a column is detected that is not present in the schema mappings.
617-
message ColumnAdditionStrategy {
618-
oneof strategy {
619-
option (buf.validate.oneof).required = false;
620-
// For any new columns, passthrough the value unchanged.
621-
Passthrough passthrough = 1;
622-
// Automatically handle unmapped columns. It handles this by using the DBs default/nullable values.
623-
// If this doesn't exist, will fall back to configuring generators for supported datatypes.
624-
// If none of the criteria above can be met, the job run will fail to prevent leaking of PII.
625-
AutoMap auto_map = 2;
626-
// halt job if a new column is detected.
627-
Halt halt = 3;
628-
}
629-
// Configuration for the Passthrough strategy
630-
message Passthrough {}
631-
// Configuration for the AutoMap strategy
632-
message AutoMap {}
633-
// Configuration for the Halt strategy
634-
message Halt {}
612+
// When a column is present in source but not mapped
613+
optional ColumnInSourceNotMappedStrategy column_in_source_not_mapped = 1;
614+
615+
// When a column is mapped but not in source
616+
optional ColumnMappedNotInSourceStrategy column_mapped_not_in_source = 2;
617+
618+
// When a column is in source + mapped, but missing in destination
619+
optional ColumnInSourceMappedNotInDestinationStrategy column_in_source_mapped_not_in_destination = 3;
620+
621+
// When a column is in the destination but no longer in source
622+
optional ColumnInDestinationNoLongerInSourceStrategy column_in_destination_no_longer_in_source = 4;
623+
}
624+
625+
// -------------------------------------------------------------
626+
// 2. MapDefinedColumns
627+
// -------------------------------------------------------------
628+
message MapDefinedColumns {
629+
// Mapped but missing in source
630+
optional ColumnMappedNotInSourceStrategy column_mapped_not_in_source = 1;
631+
632+
// In source + mapped, but missing in destination
633+
optional ColumnInSourceMappedNotInDestinationStrategy column_in_source_mapped_not_in_destination = 2;
634+
635+
// Source columns not in user mapping
636+
optional UnknownSourceColumnStrategy unknown_source_column = 3;
637+
}
638+
639+
// -------------------------------------------------------------
640+
// Sub-strategy definitions
641+
// -------------------------------------------------------------
642+
643+
// a) Column present in source, not mapped
644+
message ColumnInSourceNotMappedStrategy {
645+
oneof strategy {
646+
Passthrough passthrough = 1;
647+
AutoMap auto_map = 2;
648+
Halt halt = 3;
649+
Drop drop = 4;
635650
}
651+
message Passthrough {}
652+
message AutoMap {}
653+
message Halt {}
654+
message Drop {}
655+
}
656+
657+
// b) Column mapped, but not in source
658+
message ColumnMappedNotInSourceStrategy {
659+
oneof strategy {
660+
Continue continue = 1; // e.g. treat as NULL or skip
661+
Halt halt = 2; // fail the job
662+
}
663+
message Continue {}
664+
message Halt {}
665+
}
666+
667+
// c) Column in source + mapped, but missing in destination
668+
message ColumnInSourceMappedNotInDestinationStrategy {
669+
oneof strategy {
670+
// In your version, "Continue" = "if init_schema => create column, else skip"
671+
Continue continue = 1;
672+
Drop drop = 2;
673+
Halt halt = 3;
674+
}
675+
message Continue {}
676+
message Drop {}
677+
message Halt {}
678+
}
679+
680+
// d) Column in destination, but not in source
681+
message ColumnInDestinationNoLongerInSourceStrategy {
682+
oneof strategy {
683+
// "Continue" => "if init_schema => drop column, else leave it alone"
684+
Continue continue = 1;
685+
Halt halt = 2;
686+
}
687+
message Continue {}
688+
message Halt {}
689+
}
636690

637-
// Strategy to use when a column is removed that is present in the schema mappings.
638-
message ColumnRemovalStrategy {
639-
oneof strategy {
640-
option (buf.validate.oneof).required = false;
641-
// Continue the run if a column is removed
642-
Continue continue = 1;
643-
// Halt the run if a column is removed
644-
Halt halt = 2;
645-
}
646-
// Configuration for the Halt strategy
647-
message Halt {}
648-
649-
// Configuration for the Continue strategy
650-
message Continue {}
691+
// e) In "MapDefinedColumns" mode: columns in source that aren't in the user mapping
692+
message UnknownSourceColumnStrategy {
693+
oneof strategy {
694+
Ignore ignore = 1;
695+
Halt halt = 2;
651696
}
697+
message Ignore {}
698+
message Halt {}
652699
}
653700
}
654701

0 commit comments

Comments
 (0)