Skip to content

Commit 9d61013

Browse files
authored
feat: Revert "feat(test): Test writing to a child table" (#880)
Reverts #878 As far as I can see there is no need for this because over the wire it is always flattened anyway and in general I think we should move to always flatten structure as it causes more harm then good.
1 parent cb639cd commit 9d61013

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

internal/memdb/memdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (c *client) overwrite(table *schema.Table, data arrow.Record) {
9595
}
9696

9797
func (c *client) Migrate(_ context.Context, tables schema.Tables) error {
98-
for _, table := range tables.FlattenTables() {
98+
for _, table := range tables {
9999
tableName := table.Name
100100
memTable := c.memoryDB[tableName]
101101
if memTable == nil {

plugins/destination/plugin_testing_overwrite.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwrite(ctx context.Context,
2020
}
2121
tableName := fmt.Sprintf("cq_%s_%d", spec.Name, time.Now().Unix())
2222
table := schema.TestTable(tableName, testSourceOptions...)
23-
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
24-
parent.Relations = schema.Tables{table}
2523
syncTime := time.Now().UTC().Round(1 * time.Second)
26-
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
24+
tables := schema.Tables{
25+
table,
26+
}
27+
if err := p.Migrate(ctx, tables); err != nil {
2728
return fmt.Errorf("failed to migrate tables: %w", err)
2829
}
2930

plugins/destination/plugin_testing_overwrite_delete_stale.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
2222
table := schema.TestTable(tableName, testSourceOptions...)
2323
incTable := schema.TestTable(tableName+"_incremental", testSourceOptions...)
2424
incTable.IsIncremental = true
25-
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
26-
parent.Relations = schema.Tables{table, incTable}
2725
syncTime := time.Now().UTC().Round(1 * time.Second)
28-
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
26+
tables := schema.Tables{
27+
table,
28+
incTable,
29+
}
30+
if err := p.Migrate(ctx, tables); err != nil {
2931
return fmt.Errorf("failed to migrate tables: %w", err)
3032
}
3133

@@ -106,7 +108,7 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
106108
return fmt.Errorf("after overwrite expected first resource to be different. diff: %s", diff)
107109
}
108110

109-
resourcesRead, err = p.readAll(ctx, table, sourceName)
111+
resourcesRead, err = p.readAll(ctx, tables[0], sourceName)
110112
if err != nil {
111113
return fmt.Errorf("failed to read all second time: %w", err)
112114
}
@@ -122,7 +124,7 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
122124

123125
// we expect the incremental table to still have 2 resources, because delete-stale should
124126
// not apply there
125-
resourcesRead, err = p.readAll(ctx, incTable, sourceName)
127+
resourcesRead, err = p.readAll(ctx, tables[1], sourceName)
126128
if err != nil {
127129
return fmt.Errorf("failed to read all from incremental table: %w", err)
128130
}

plugins/destination/plugin_testing_write_append.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
1919
}
2020
tableName := fmt.Sprintf("cq_%s_%d", spec.Name, time.Now().Unix())
2121
table := schema.TestTable(tableName, testSourceOptions...)
22-
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
23-
parent.Relations = schema.Tables{table}
2422
syncTime := time.Now().UTC().Round(1 * time.Second)
25-
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
23+
tables := schema.Tables{
24+
table,
25+
}
26+
if err := p.Migrate(ctx, tables); err != nil {
2627
return fmt.Errorf("failed to migrate tables: %w", err)
2728
}
2829

@@ -52,7 +53,7 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
5253
}
5354
}
5455

55-
resourcesRead, err := p.readAll(ctx, table, sourceName)
56+
resourcesRead, err := p.readAll(ctx, tables[0], sourceName)
5657
if err != nil {
5758
return fmt.Errorf("failed to read all second time: %w", err)
5859
}

0 commit comments

Comments
 (0)