Frank
Frank

Reputation: 3

ADF Dataflow to replace square brackets [ ] in column headers

I have a blobstorage container with csv files and copy them to SQL. In the column headers there are [ ] on every column header.
The [ ] in the headers causes errors on the SQL table side, so we want to replace them with nothing in the pipeline with a dataflow.

If I run the json below as Dataflow I get an error:

Job failed due to reason: at Sink 'sink1': The identifier that starts with 'persoonsnummer |Volgnr dienstverband|Version|Objectid|Pslot_sel|Current niveau autorisatie|Code regeling ORD|Code regeling OVW|C' is too long. Maximum length is 128.

Question: because of too much columns ? Or the first row cant have more then 128 characters
bottomline the question is how to adjust it so it works and why this doesn't .

{
    "name": "DF_Beaufort_CSV_to_SQL_copy1",
    "properties": {
        "type": "MappingDataFlow",
        "typeProperties": {
            "sources": [
                {
                    "dataset": {
                        "referenceName": "DS_S_Beaufort_YFDienstverbanden",
                        "type": "DatasetReference"
                    },
                    "name": "source1"
                }
            ],
            "sinks": [
                {
                    "dataset": {
                        "referenceName": "DS_D_Beaufort_SQL",
                        "type": "DatasetReference"
                    },
                    "name": "sink1"
                }
            ],
            "transformations": [
                {
                    "name": "select1"
                }
            ],
            "scriptLines": [
                "source(output(",
                "          {[persoonsnummer ]|[Volgnr dienstverband]|[Version]|[Objectid]|[Pslot_sel]|[Current niveau autorisatie]|[Code regeling ORD]|[Code regeling OVW]|[Code regeling AVBAS]|[Code regeling BAW]|[Code regeling SLD]|[Code regeling VBD]|[Code regeling VSD]|[Code regeling ALG]|[Code regeling OVBAS]|[Soort arbeidsrelatie]|[Opdrachtgever]|[Instelling]|[Registratienummer]|[Datum in dienst]|[Organisatorische eenheid]|[Functie]|[Opzegtermijn in mnd]|[Kode normuren]|[Uren per week]|[Percentage deelbetrekking]|[Werkdagen per week]|[Doelgroep]|[Koppelen]|[Datum uit dienst]|[Reden einde dienstverband]|[Soort loner]|[Code salarisregeling]|[Schaal]|[Ancienniteit/functiejaren]|[Inpassingsnummer]|[Extra treden]|[Nominaal salaris]|[Nominaal uurloon]|[Blokkade aanvulling min.loon]|[Blokkade jeugdaftrek]|[Afw. %jeugdaftrek]|[Garantie schaal]|[Ancienniteit]|[Garantie inpasnummer]|[Nominaal garantiesalaris]|[Code deeldiensttijd]|[% Wachtgeld]|[Soort diensttijd ABP]|[Expiratiedatum ABP]|[Garantiesalaris]|[Garantie uurloon]|[Bruto salaris]|[Bruto uurloon]|[Sprongen periodiek]|[Maand periodiek]|[Blokkade periodiek]|[Sprongen periodiek garantiesalaris]|[Maand periodiek garantiesalaris]|[Laatste periodiek]|[Loonheffingskorting]|[Soort loonheffingstabel]|[Procentuele inschaling]|[Code tariefgroep beschikking]|[Soort werknemersverzekering]|[Afwijkende SV-dagen]|[Soort pensioenfonds]|[Datum intreding pensioenfonds]|[Datum uittreding pensioenfonds]|[Reden uittreding pensioenfonds]|[Code verlofregeling]|[Keuze feestdagenset]|[Datum in dienst CAO]|[Ingangsdatum werkpatroon]|[Datum/tijd laatste herberekening salaris ]|[Basissalaris/uurloon ]|[Jeugdkorting ]|[Deeltijd salaris/uurloon ]|[Basis garantiesalaris/uurloon ]|[Jeugdkorting  garantiesalaris/uurloon]|[Aanvulling garantiesalaris / uurloon ]|[Aanvulling minimumloon/uurloon ]|[Basissalaris/uurloon  eerstvolgende period.]|[Basis garantiesalaris/uurloon eerstvolgende period. ]|[Beroep]|[Blokkade ziekteregistratie]|[Ingangsdatum WAO]|[% WAO]|[% WAO uitkering]|[WAO uitkering]|[Ingangsdatum herintreding WAO]|[Ingangsperiode blokkade ziekte salarisverwerker]|[Afw. wachtdagen ZW uitkering]|[Zorgverzekeraar]|[Inschrijfnr.]|[Ing. datum]|[Einddatum]|[Reden]|[Afw. reden]|[Volgnr IKV]|[Volgnr PGGM]|[Percentage Verhoging]|[Code tellen SV-dagen en uren uurloners]|[Aanmaken variabele LV mutaties]|[Blokkeren verdeling TR]|[Verdeelgroep]|[Instellingsnr. hoofddienstvb.]|[Registratienr. hoofddienstvb.]|[FA pakket]|[Status FA]|[Verlofrecht]|[Gewenst aantal vakantiedagen]|[Verlofrecht verkocht]|[Saldo spaarverlof]|[Spaarverlof mutatie]|[Huidige FA versie]|[Perc. deelbetr. F&O]|[Perc. deelbetr. B&B]|[Perc. deelbetr. verlof]|[Reisafstand woon-werk]|[Aantal reisdagen]|[Aantal niet-reisdagen]|[Vergoeding woon-werk]|[ind.blk.fsc.vrije reisk.]|[Percentage Merit-rating]|[Correctie basissalaris]|[Garantietoelage]|[Levensloopverlofkorting]|[Korting uitkering]|[Perc doorbet. langdurig ziek]|[Vrijw voortzetting PGGM]|[Reden uittrede PGGM]|[Soort inkomstenverhouding]|[Aard arbeidsverhouding]|[Invloed verzekeringsplicht]|[Soort contract]|[Code inkomstenvermindering]|[Arbeidsgehandicaptenkorting]|[Ind. loon incl. WAJONG]|[Ind.  personeelslening]|[Afwijk. risicopremie groep]|[Speciale werknemer]|[Jaarloon  bijz. beloning]|[Perc. bijzonder tarief]|[Code blokk. voordeel]|[Loonheffing Blokkering]|[Code bedrijfsauto]|[Code netto loner]|[52% trf loonheffing]|[Vermindering loonh.]|[WIA IVA Uitkering]|[WIA WGA Uitkering]|[Gekoppeld dienstverband indicatie]|[Ind.ber.verlofr.meeruren]} as string",
                "     ),",
                "     allowSchemaDrift: true,",
                "     validateSchema: false,",
                "     ignoreNoFilesFound: false) ~> source1",
                "source1 select(mapColumn(",
                "          each(match(true()),",
                "               replace(replace($$,'[',''),']','') = $$)",
                "     ),",
                "     skipDuplicateMapInputs: true,",
                "     skipDuplicateMapOutputs: true) ~> select1",
                "select1 sink(allowSchemaDrift: true,",
                "     validateSchema: false,",
                "     deletable:false,",
                "     insertable:true,",
                "     updateable:false,",
                "     upsertable:false,",
                "     recreate:true,",
                "     format: 'table',",
                "     skipDuplicateMapInputs: true,",
                "     skipDuplicateMapOutputs: true,",
                "     errorHandlingOption: 'stopOnFirstError') ~> sink1"
            ]
        }
    }
}

Upvotes: 0

Views: 164

Answers (1)

Rakesh Govindula
Rakesh Govindula

Reputation: 11454

enter image description here

The above error occurs when the column length is too long and if its more than 128 characters.

You can see I got same error in SQL, when I tried to create a table with a column of length more than 128.

enter image description here

There is no error in your dataflow transformations. The reason for the above error in dataflow is your csv file is a Pipe (|) separated file. Due to , delimiter in the dataset, it considered all columns as a single column which caused the above error. So, you need to change the Column delimiter in the dataset to | from the default delimiter ,.

enter image description here

Now, import the schema in the dataset or in the dataflow source projection.

enter image description here

After importing the new schema, debug the dataflow activity in the pipeline and your columns will be copied as expected like below.

enter image description here

Upvotes: 0

Related Questions