query::sql

Function check_file_to_table_schema_compatibility

source
pub fn check_file_to_table_schema_compatibility(
    file_column_schemas: &[ColumnSchema],
    table_column_schemas: &[ColumnSchema],
) -> Result<()>
Expand description

This function checks if the column schemas from a file can be matched with the column schemas of a table.

More specifically, for each column seen in the table schema,

  • If the same column does exist in the file schema, it checks if the data type of the file column can be casted into the form of the table column.
  • If the same column does not exist in the file schema, it checks if the table column is nullable or has a default constraint.