The command
COPY INTO
from Databricks provides an idempotent file ingestion into a delta table, see here. From the docs, an example command looks like this:
COPY INTO delta.`target_path`
FROM (SELECT key, index, textData, 'constant_value' FROM 'source_path')
FILEFORMAT = CSV
PATTERN = 'folder1/file_[a-g].csv'
FORMAT_OPTIONS('header' = 'true')
However, I want my data to be ingested via a partition, which can be accomplished with the
PARTITIONED BY
command in a normal ingestion. Is it possible to execute a
COPY INTO
command with partitioning? Simply adding the partitioning clause yields the following error:
Error in SQL statement: ParseException:
mismatched input 'PARTITIONED' expecting {<EOF>, ';'}(line 8, pos 0)