列是没有时区的时间戳类型,但表达式的类型是字符变化:Nifi [英] Column is of type timestamp without time zone but expression is of type character varying : Nifi

查看:63
本文介绍了列是没有时区的时间戳类型,但表达式的类型是字符变化:Nifi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 nifi 将 CSV 记录插入 Postgres 数据库.

I am trying to insert CSV records to Postgres database using nifi.

示例 csv 文件:

timenow,location
'2019-10-21 15:13:11','colombo'

nifi 场景运行时出现如下错误

When nifi scenario runs, it gives following error

错误列 'timenow' 属于没有时区的时间戳类型,但表达式属于不同类型的字符

Error column 'timenow' is of type timestamp without time zone but expression is of type character varying

如果我使用普通 insert into conditions (timenow,location) values ('2019-10-21 15:13:11','colombo');

没有错误值插入到表中.我是否必须更改 nifi 配置才能将其添加到表中?

No errors values inserted to table. Do I have to change nifi configurations to add this to table?

我改变了 Nifi CSVReader -> 时间戳格式 YYYY-MM-DD HH:MM:SS

I have changed Nifi CSVReader -> Timestamp format YYYY-MM-DD HH:MM:SS

第一次评论后Nifi 生成的查询是:INSERT INTO public.conditions (timenow, location) VALUES ('2019-10-21 15:13:11','colombo')

After first comment Nifi generated query is : INSERT INTO public.conditions (timenow, location) VALUES ('2019-10-21 15:13:11','colombo')

我已经将它与 timescaledb 终端一起使用并插入了记录.

I have used this with timescaledb terminal and it inserted the record.

推荐答案

这是 nifi 方面的一个简单修复.

It was a simple fix in nifi side.

DBCPConnectionPool -> 数据库 URL -> jdbc:postgresql://localhost:5432/databaseName?stringtype=unspecified

In DBCPConnectionPool -> Database URL -> jdbc:postgresql://localhost:5432/databaseName?stringtype=unspecified

ajaytigga0210 在 面对日期和时间戳列的问题

Answer was given by ajaytigga0210 on Facing issues with Date and Timestamp Columns

这篇关于列是没有时区的时间戳类型,但表达式的类型是字符变化:Nifi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆