diff --git a/CHANGELOG.md b/CHANGELOG.md index 182d154d..520bbed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Types of changes - `Added` possibility to filter columns via `select` property in ingress descriptors - `Added` commands `set-parent-select` and `set-child-select` to `lino id` +- `Added` `import: no` option for columns in `tables.yaml` configuration ## [3.0.2] diff --git a/pkg/push/driver.go b/pkg/push/driver.go index 9f5a1294..96800ee4 100755 --- a/pkg/push/driver.go +++ b/pkg/push/driver.go @@ -175,11 +175,19 @@ func FilterRelation(row Row, relations map[string]Relation, whereField string) ( // pushRow push a row in a specific table func pushRow(row Row, ds DataDestination, table Table, plan Plan, mode Mode, translator Translator, whereField string) *Error { frow, fwhere, frel, fInverseRel, err1 := FilterRelation(row, plan.RelationsFromTable(table), whereField) - if err1 != nil { return err1 } + // remove not imported values from frow + if columns := table.Columns(); columns != nil { + for i := uint(0); i < columns.Len(); i++ { + if columns.Column(i).Import() == "no" { + delete(frow, columns.Column(i).Name()) + } + } + } + rw, err2 := ds.RowWriter(table) if err2 != nil { return err2 diff --git a/tests/suites/push/import.yml b/tests/suites/push/import.yml index 3628f551..4420aa3b 100644 --- a/tests/suites/push/import.yml +++ b/tests/suites/push/import.yml @@ -125,3 +125,25 @@ testcases: - result.code ShouldEqual 0 - result.systemout ShouldBeEmpty - result.systemerr ShouldBeEmpty + + - name: import no + steps: + - script: lino table extract source --only-tables + - script: lino pull source --table customer --limit 0 | lino push truncate dest --table customer + - script: |- + cat > tables.yaml <