Copy Into command to copy into delta table with predefined schema and csv file has no headers

DataInsight
Databricks Partner

How do i use copy into command to load 200+ tables with 50+ columns into a delta lake table with predefined schema. I am looking for a more generic approach to be handled in pyspark code.

I am aware that we can pass the column expression into the select clause but passing column name into the select clause seems to be more tedious task.

any help over this is really appreciated 

Lakshay
Databricks Employee
Databricks Employee

Does your source data have same number of columns as your target Delta tables? In that case, you can do it this way:
COPY INTO my_pipe_data
FROM 's3://my-bucket/pipeData'
FILEFORMAT = CSV
FORMAT_OPTIONS ('mergeSchema' = 'true',
'delimiter' = '|',
'header' = 'true')