pub fn ensure_schema(
tables: HashMap<String, HashMap<String, DataType>>,
dialect: Dialect,
) -> MappingSchemaExpand description
Build a MappingSchema from a nested map structure.
The input maps from table name → column name → data type, mirroring the common pattern of constructing schemas from DDL or metadata.
§Example
use std::collections::HashMap;
use sqlglot_rust::schema::{ensure_schema, Schema};
use sqlglot_rust::ast::DataType;
use sqlglot_rust::Dialect;
let mut tables = HashMap::new();
let mut columns = HashMap::new();
columns.insert("id".to_string(), DataType::Int);
columns.insert("name".to_string(), DataType::Varchar(Some(255)));
tables.insert("users".to_string(), columns);
let schema = ensure_schema(tables, Dialect::Postgres);
assert!(schema.has_column(&["users"], "id"));