Skip to content

Commit

Permalink
fix: extract extra tables
Browse files Browse the repository at this point in the history
  • Loading branch information
thoas committed Jun 4, 2024
1 parent 97ee98b commit bad3233
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions etl/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,22 @@ func (e *Engine) Extract(ctx context.Context, outputPath, query string) error {
return fmt.Errorf("unable to extract %s (query %s): %w", tableName, query, err)
}

for tableName := range cache {
if err := e.extract(ctx, outputPath, e.schema[tableName], cache[tableName]); err != nil {
return fmt.Errorf("unable to extract rows from table %s: %w", tableName, err)
}
}

for i := range e.config.Extra {
tableName := e.config.Extra[i].TableName
query, _ := lk.Select(lk.Raw("*")).
From(tableName).Query()
_, err = extractor.Handle(ctx, e.schema[tableName], query)
cache, err = extractor.Handle(ctx, e.schema[tableName], query)
if err != nil {
return fmt.Errorf("unable to extract %s (query %s): %w", tableName, query, err)
}
}

for tableName := range cache {
if err := e.extract(ctx, outputPath, e.schema[tableName], cache[tableName]); err != nil {
return fmt.Errorf("unable to extract rows from table %s: %w", tableName, err)
}
}

return nil
}

Expand Down

0 comments on commit bad3233

Please sign in to comment.