Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Convert column data type in querydatabasetable

avatar
New Member

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
New Member

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.