ErrorCode=InvalidParameter,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The value of the property 'columns' is invalid: 'Value cannot be null. Parameter name: columns'.,Source=,''Type=System.ArgumentNullException,Message=Valu

TUMMALAPELLY, Sandeep 0 Reputation points
2025-03-12T18:01:16.0466667+00:00

Hi,

Am new to Postgresql, am trying to fetch the column list and their respective data types for a Postgresql table using a lookup activity within a foreach container in ADF . Query is working fine and fetching the expected output when executed in Azure Data Studio. however it is failing with the error in ADF.

ErrorCode=InvalidParameter,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The value of the property 'columns' is invalid: 'Value cannot be null.

Parameter name: columns'.,Source=,''Type=System.ArgumentNullException,Message=Value cannot be null.

Parameter name: columns,Source=Microsoft.DataTransfer.Common,'

Following is the query used in Lookup activity.

DO $$ 
DECLARE 
    ColList TEXT := ''; 
    DataTypeList TEXT := ''; 
    col_sep TEXT := '@{pipeline().parameters.ColumnSeparator}'; 
    tablename TEXT := '@{item().table}'; 
    schemaname TEXT := '@{item().schema}'; 
BEGIN 
    SELECT 
        STRING_AGG('"' || column_name || '"', col_sep) AS ColList,
        STRING_AGG(data_type, col_sep) AS DataTypeList
    INTO ColList, DataTypeList
    FROM information_schema.columns 
    WHERE table_name = tablename 
    AND table_schema = schemaname;

    RAISE NOTICE '%', ColList;
    RAISE NOTICE '%', DataTypeList; 
END $$;
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,340 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chandra Boorla 9,985 Reputation points Microsoft External Staff
    2025-03-12T22:51:10.0333333+00:00

    @TUMMALAPELLY, Sandeep

    It looks like the issue is occurring because the ADF Lookup activity expects a tabular result, but your current query does not return a result set. Instead, it assigns values to variables and uses RAISE NOTICE, which does not return data in a format that ADF can process.

    Why Does This Query Fail in ADF?

    ADF Lookup Activity Expecting a Table Format - ADF Lookup expects a tabular result (rows and columns), but this query does not return a result set. Instead, it stores results in variables (ColList, DataTypeList) and prints them using RAISE NOTICE, which is not useful in ADF.

    Solution: Use a SELECT Statement Instead of RAISE NOTICE

    Replace:

    RAISE NOTICE '%', ColList;
    RAISE NOTICE '%', DataTypeList;
    

    With:

    SELECT ColList AS column_names, DataTypeList AS data_types;
    

    This way, ADF Lookup will receive a proper table format like:

    • column_names - "id","name","age"
    • data_types - integer,text,integer

    Why This Fix Works?

    Instead of just printing values, this query returns a table format (column_names and data_types). ADF Lookup activity can now capture and process the output correctly.

    I hope this information helps. Please do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.