Azure Data Flow : how to eliminate columns with empty names in csv file

javier cohenar 211 Reputation points
2023-07-26T18:31:43.8733333+00:00

A supplier sends us CSV files regularly that sometimes include empty column names like this:

columnName1, columnName2,,,,,

Downstream process (Data Flow Activity) requires that the columns have no empty names (otherwise it will fail).

In order to achieve this, I have (unsuccessfully) tried:

  1. in Data Flow Activity: add rule based mapping (Select operation) with name!=""

Please advise on how to best deal with this situation

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,652 questions
{count} vote

Accepted answer
  1. QuantumCache 20,366 Reputation points Moderator
    2023-07-27T01:34:04.2+00:00

    Hello @javier cohenar,

    In order to achieve this, I have (unsuccessfully) tried:

    1. in Data Flow Activity: add rule based mapping (Select operation) with name!=""

    Could you please add more info on what is the blocker here? any specific scenario failing the Select Transformation?

    Hello @javier cohenar,

    Below shows the Select Transformation : Rule Match expression.

    I have used 2 Rules, please check!

    User's image

    User's image

    User's image

    User's image

    User's image

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Nandan Hegde 36,151 Reputation points MVP Volunteer Moderator
    2023-07-27T04:08:13.4633333+00:00

    Hey,

    You can use the Get Meta data activity on the file dataset :

    User's image

    And select the structure list

    Enable the 1st row as header in the dataset :

    User's image

    and add a character within the column delimiter which you wont expect in file.

    Output :

    User's image

    You can compare this output with the expected column list parameter you have.

    If these 2 match, proceed ahead else take necessary actions.

    Note:

    You can also use Contains function on the output to check whether the list has name name like column

    @string(contains(Getmetadatastructure,'column'))
    

    If there are empty columns use a copy activity to copy specifc columns from the source file to another file and this you can use the mapping section of copy activity

    w.r.t Dataflow, you can use the below reference :

    https://stackoverflow.com/questions/63781415/remove-specific-columns-using-azure-data-factory

    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.