Skip to content

UNION fails with NUM_COLUMNS_MISMATCH when schema changes #518

Description

@Mart-Kruisselbrink

Hi,

We are using bc2adls with the provided notebook to load data into a Microsoft Fabric Lakehouse. This setup has worked perfect so far, but we encountered the following error:

AnalysisException
[NUM_COLUMNS_MISMATCH] UNION can only be performed on inputs with the same number of columns, but the first input has 214 columns and the second input has 205 columns.

This occurs when the schema of incoming data changes (e.g. new/missing columns in Business Central), while the existing table in the Lakehouse still has the old schema.

The error originates from the union between new and existing data:

df_combined = df_new_filtered.union(df_old)

Impact:

Pipelines fail when schema changes occur, requiring manual intervention. Resetting the export from Business Central to Fabric is a time-consuming workaround and requires significant manual effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions