Created 03-01-2018 02:58 PM
Hello,
Using InferAvroSchema I got an avro Schema of my file. I want to create at able in PostregSql using this avroSchema. Which processor I have to use and connect to InferAvroSchema to create my table.
Thank you!
Created 03-01-2018 03:09 PM
How big is your avro Schema? There is always the workaround of hard-coding the column names to the SQL query.
Created 03-01-2018 03:12 PM
for my test file I have 10 columns but I want the work to be done independently of this file. For example, I want to use getfile-> infeAvroSchema-> Create the table in Postgresl and then use PutdatabaseRecod. Once I have my schema generated I do not know what exactly to use to create the table.
Created 03-01-2018 03:59 PM
Created 03-02-2018 10:16 AM
Sorry, can't really help you with that. But there is a processor for executing SQL statements. Maybe that might help. @Amira khalifa
Created 03-03-2018 12:07 AM
There is no standard processor capable to address your requirement. You would have to build a custom processor to generate the DDL or use ExecuteSQL or ExecuteScript processor. Anyhow, keep in mind that avro data types are not an exact match with Postgresql data types to not mention that your avro may be hierarchical. For that situation I suggest you to follow the steps: ConvertAvroToJson -> FlattenJson -> ConvertJsonToSQL -> ExecuteSQL. This is just one approach, you can do it in several ways including using Record processors.