Skip to content

Commit 919cbc4

Browse files
committed
Update soruceddl with columna and table getter
1 parent 80ad7f4 commit 919cbc4

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/migrations/schema/Schema.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ public Schema(
8989
this.spSchema = spSchema;
9090
this.syntheticPKeys = syntheticPKeys;
9191
this.srcSchema = srcSchema;
92+
this.toSpanner = new HashMap<String, NameAndCols>();
93+
this.toSource = new HashMap<String, NameAndCols>();
94+
this.srcToID = new HashMap<String, NameAndCols>();
95+
this.spannerToID = new HashMap<String, NameAndCols>();
9296
this.empty = (spSchema == null || srcSchema == null);
9397
}
9498

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/sourceddl/SourceSchema.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ public abstract static class Builder {
5454

5555
public abstract SourceSchema build();
5656
}
57+
58+
public SourceTable table(String tableName) {
59+
return tables().get(tableName);
60+
}
5761
}

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/sourceddl/SourceTable.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,13 @@ public abstract static class Builder {
6666

6767
public abstract SourceTable build();
6868
}
69+
70+
public SourceColumn column(String name) {
71+
for (SourceColumn c : columns()) {
72+
if (c.name().equals(name)) {
73+
return c;
74+
}
75+
}
76+
return null;
77+
}
6978
}

0 commit comments

Comments
 (0)