Search code examples
postgresqlapache-nifi

Add a column with filename to Psql table in nifi


I have a table that consists of 2 columns

 cattlegendernm | price 
----------------+-------    
 Female         | 10094     
 Female         | 12001     
 Male           | 12704   

I would like to add another column with filename to this table using a nifi processor. Which Processor and SQL query should I use for this ?


Solution

  • Using a PutSQL processor would be suitable to add such a DDL statement like

    ALTER TABLE T ADD COLUMN filename VARCHAR(150)
    

    into the SQL Statement attribute of the properties tab as illustrated below

    enter image description here

    where PostGRES_DB represents a pre-configured Controller Service to interact with the database