Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:39 AM
Thanks for the input. I previously experimented with the Auto Loader, but was stopped by the fact that the headers in my csv files contains spaces and illegal characters. Hence the error
AnalysisException:
Found invalid character(s) among " ,;{}()\n\t=" in the column names of your
schema.
Please enable column mapping by setting table property 'delta.columnMapping.mode' to 'name'.
For more details, refer to https://docs.microsoft.com/azure/databricks/delta/delta-column-mapping
Or you can use alias to rename it.Passing an option to set the column mapping to name did not resolve it
.writeStream
.format("delta")
.option("checkpointLocation",checkpoint_location)
.option("optimizeWrite","True")
.option("schemaEvolutionMode","addNewColumns")
.option("delta.columnMapping.mode", "name")
.trigger(once=True)
.toTable(table_name))Creating the target table with mapping name prior to starting the stream did not help, as I got error messages related to schema mismatch.
I could not think of any way to rename all my 80+ columns "on the fly".