From bad32335658d5f8194b2ae15df3fe69a2413ed16 Mon Sep 17 00:00:00 2001 From: Florent Messa Date: Tue, 4 Jun 2024 14:56:20 +0200 Subject: [PATCH] fix: extract extra tables --- etl/engine.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etl/engine.go b/etl/engine.go index ec42a38..0e39f3e 100644 --- a/etl/engine.go +++ b/etl/engine.go @@ -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 }