Pentaho Kettle - 从 JSON 表输出到 Postgresql JSONB 字段

Pau*_*mas 2 postgresql json pentaho kettle jsonb

如何让 Pentaho Kettle 将 JSON 数据发送到 PostgreSQL JSONB 字段?每当我尝试将 JSON 数据输出到 Postgresql JSONB 字段类型时,我都会收到错误消息。将 JSON 数据发送到 PostgreSQL 文本字段工作正常,但我想在 PostgreSQL 中维护 JSON 格式。

在 Kettle 论坛上发布了这个问题,但没有得到回应。所以我正在尝试这个论坛。

感谢您的输入!

编辑:当我运行 Pentaho Kettle 转换并且 Postgresql 中的目标字段是 JSONB 类型时,我收到此错误:

2015/10/29 15:39:32 - Table output 2.0 - Connected to database [test] (commit=1000)
2015/10/29 15:40:43 - Table output 2.0 - ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : Unexpected batch update error committing the database connection.
2015/10/29 15:40:43 - Table output 2.0 - ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseBatchException: 
2015/10/29 15:40:43 - Table output 2.0 - Error updating batch
2015/10/29 15:40:43 - Table output 2.0 - Batch entry 0 INSERT INTO test_raw_dataj (sensor_readings) VALUES ( '{"data":[{"readings":"[[1325404802000,2.8020381927490234],[1325404812000,2.8020381927490234],[1325404822000,2.817678451538086],[1325404832000,2.817678451538086],[1325404842000,2.8333663940429688],[1325404852000,2.8333663940429688]]","id":"59997f"}]}') was aborted.  Call getNextException to see the cause.
2015/10/29 15:40:43 - Table output 2.0 -    at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2743)
2015/10/29 15:40:43 - Table output 2.0 -    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1928)
2015/10/29 15:40:43 - Table output 2.0 -    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:405)
2015/10/29 15:40:43 - Table output 2.0 -    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2892)
2015/10/29 15:40:43 - Table output 2.0 -    at org.pentaho.di.core.database.Database.emptyAndCommit(Database.java:1362)
2015/10/29 15:40:43 - Table output 2.0 -    ... 3 more
2015/10/29 15:40:43 - Table output 2.0 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)
Run Code Online (Sandbox Code Playgroud)

但是,运行相同的转换并且 Postgresql 中的目标字段是 TEXT 类型,一切正常。

Mar*_*oon 6

我试图重现这个问题,最后我找到了解决方案。
在你的table output脚步

  • 转到连接前面的编辑​​按钮
  • 然后选择选项。
  • 给出参数值如下

参数 stringtype unspecified

在此处输入图片说明

注意:在常规选项卡中,您必须将连接类型选择为 PostgreSQL 并填写必要的设置。