Postgresql NIFI使用日期字段将CSV文件插入Postgres数据库
我想将csv文件插入我的postgres数据库。我使用处理器:Postgresql NIFI使用日期字段将CSV文件插入Postgres数据库,postgresql,csv,apache-nifi,avro,Postgresql,Csv,Apache Nifi,Avro,我想将csv文件插入我的postgres数据库。我使用处理器: Getfiles -> Split (cause files are big) -> UpdateAttribute (to add avro.schema) -> ConvertCSvToAvro -> Putdatabaserecord. 如果我只使用字符串/文本字段(在我的avro模式和列postgres数据库中),结果是ok的。 但是,当我试图格式化日期字段时,出现了一个错误 我的原始数据(CSV
Getfiles ->
Split (cause files are big) ->
UpdateAttribute (to add avro.schema) ->
ConvertCSvToAvro ->
Putdatabaserecord.
如果我只使用字符串/文本字段(在我的avro模式和列postgres数据库中),结果是ok的。
但是,当我试图格式化日期字段时,出现了一个错误
我的原始数据(CSV)是:
我的avro模式是:
{
"type":"record",
"name":"public.data_scope_gp_temp",
"fields":[
{"name":"date_export","type":{ "type": "int", "logicalType": "date"}},
{"name":"num_etiquette","type":"string"},
{"name":"cle_scope","type":"string"}
]}
我的postgres模式是:
date_export date,
num_etiquette text COLLATE pg_catalog."default",
key text COLLATE pg_catalog."default"
有什么想法吗?使用PutDatabaseRecord不需要UpdateAttribute或ConvertCsvToAvro。您可以在PutDatabaseRecord中指定CSVReader,并且您的CSVReader可以在schema Text属性中提供Avro架构(不要忘记设置使用架构文本的架构策略)。使用PutDatabaseRecord不需要UpdateAttribute或ConvertCsvToAvro。您可以在PutDatabaseRecord中指定CSVReader,并且您的CSVReader可以在schema Text属性中提供Avro模式(不要忘记将您的模式策略设置为使用模式文本)
date_export date,
num_etiquette text COLLATE pg_catalog."default",
key text COLLATE pg_catalog."default"