Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/memdb/memdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c *client) overwrite(table *schema.Table, data arrow.Record) {
}

func (c *client) Migrate(_ context.Context, tables schema.Tables) error {
for _, table := range tables.FlattenTables() {
for _, table := range tables {
tableName := table.Name
memTable := c.memoryDB[tableName]
if memTable == nil {
Expand Down
7 changes: 4 additions & 3 deletions plugins/destination/plugin_testing_overwrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwrite(ctx context.Context,
}
tableName := fmt.Sprintf("cq_%s_%d", spec.Name, time.Now().Unix())
table := schema.TestTable(tableName, testSourceOptions...)
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
parent.Relations = schema.Tables{table}
syncTime := time.Now().UTC().Round(1 * time.Second)
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
tables := schema.Tables{
table,
}
if err := p.Migrate(ctx, tables); err != nil {
return fmt.Errorf("failed to migrate tables: %w", err)
}

Expand Down
12 changes: 7 additions & 5 deletions plugins/destination/plugin_testing_overwrite_delete_stale.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
table := schema.TestTable(tableName, testSourceOptions...)
incTable := schema.TestTable(tableName+"_incremental", testSourceOptions...)
incTable.IsIncremental = true
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
parent.Relations = schema.Tables{table, incTable}
syncTime := time.Now().UTC().Round(1 * time.Second)
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
tables := schema.Tables{
table,
incTable,
}
if err := p.Migrate(ctx, tables); err != nil {
return fmt.Errorf("failed to migrate tables: %w", err)
}

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

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

// we expect the incremental table to still have 2 resources, because delete-stale should
// not apply there
resourcesRead, err = p.readAll(ctx, incTable, sourceName)
resourcesRead, err = p.readAll(ctx, tables[1], sourceName)
if err != nil {
return fmt.Errorf("failed to read all from incremental table: %w", err)
}
Expand Down
9 changes: 5 additions & 4 deletions plugins/destination/plugin_testing_write_append.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
}
tableName := fmt.Sprintf("cq_%s_%d", spec.Name, time.Now().Unix())
table := schema.TestTable(tableName, testSourceOptions...)
parent := schema.TestTable(tableName+"_parent", testSourceOptions...)
parent.Relations = schema.Tables{table}
syncTime := time.Now().UTC().Round(1 * time.Second)
if err := p.Migrate(ctx, schema.Tables{parent}); err != nil {
tables := schema.Tables{
table,
}
if err := p.Migrate(ctx, tables); err != nil {
return fmt.Errorf("failed to migrate tables: %w", err)
}

Expand Down Expand Up @@ -52,7 +53,7 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
}
}

resourcesRead, err := p.readAll(ctx, table, sourceName)
resourcesRead, err := p.readAll(ctx, tables[0], sourceName)
if err != nil {
return fmt.Errorf("failed to read all second time: %w", err)
}
Expand Down