Support Questions

Find answers, ask questions, and share your expertise

Convert column data type in querydatabasetable

avatar
Contributor

Hi, I'm getting some data from a pg database, and it has 2 "Text" types, which I think are my problem. When I go to insert those to a redshift table, i'm getting a jdbc error, "given type does not match given object". I think i need to use nifi expression language to convert the text column toString, so it will work with varchar, but i'm not sure. any help appreciated.

Thanks,

Ron

1 ACCEPTED SOLUTION

avatar
Master Guru
@Ron Labau

Try to use Cast the fields names to Varchar in your QueryDatabaseTable processor configs in Columns to Return.

If the above method doesn't work then Use ConvertRecord processor to read your Incoming Avro data and in Record SetWriter configure the field names to have string datatype.

So that we are going have OutputFlowfile in Avro format with string datatype.

Refer to this link for configuring/usage of the ConvertRecord processor.

View solution in original post

3 REPLIES 3

avatar
Master Guru
@Ron Labau

Try to use Cast the fields names to Varchar in your QueryDatabaseTable processor configs in Columns to Return.

If the above method doesn't work then Use ConvertRecord processor to read your Incoming Avro data and in Record SetWriter configure the field names to have string datatype.

So that we are going have OutputFlowfile in Avro format with string datatype.

Refer to this link for configuring/usage of the ConvertRecord processor.

avatar
Contributor

Thanks Shu, that seems to work! is that expression language, or is that basically doing regular sql functions on the db?

Thanks!

avatar
Master Guru

@Ron Labau

if you are using QueryDatabaseTable processor then it is regular sql function on db.
if you are using convertRecord processor then we are doing in NiFi.