是否可以使用 kiba-etl gem 跳过加载一行?

Is it possible to skip loading a row using the kiba-etl gem?

如果我认为使用 kiba-etl 的行无效,有没有办法可以跳过加载某些行 gem?

例如,如果在我将其加载到系统之前必须通过验证,或者发生错误并且我仍然需要将数据推送到 sys,而不管在记录问题时。

我很笨。我意识到你可以在 transformation/loading 过程中捕获你的错误并且 return nil.

这里是 Kiba 的作者!要从管道中删除一行,只需在转换结束时 return nil:

transform do |row|
  row_valid = some_custom_operation
  row_valid ? row : nil
end

您还可以 "write down" 有问题的行,稍后使用像这样的 post_process 块报告它们(在这种情况下,需要中等到少量的伪造行):

@bogus_row_ids = []

transform do |row|
  # SNIP
  if row_valid(row)
    row
  else
    @bogus_row_ids << row[:id]
    nil # remove from pipeline
  end
end

post_process do
  # do something with @bogus_row_ids, send an email, write a file etc
end

让我知道这是否正确回答了您的问题,或者您是否需要更精确的答案。