- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Convert column data type in querydatabasetable
- Labels:
-
Apache NiFi
Created on ‎08-23-2018 08:46 PM - edited ‎09-16-2022 06:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎08-23-2018 09:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎08-23-2018 09:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎08-24-2018 03:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Shu, that seems to work! is that expression language, or is that basically doing regular sql functions on the db?
Thanks!
Created ‎08-24-2018 06:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
