# `Fivetrex.Models.SchemaConfig`
[🔗](https://github.com/lostbean/fivetrex/blob/v0.2.3/lib/fivetrex/models/schema_config.ex#L1)

Represents the schema configuration for a Fivetran connector.

Schema configuration controls which schemas, tables, and columns are synced
from your data source to your destination. This struct contains the hierarchical
configuration of all database objects.

## Structure

The configuration follows a nested hierarchy:

    SchemaConfig
      └── schemas (map of Schema by name)
            └── tables (map of Table by name)
                  └── columns (map of Column by name)

## Fields

  * `:enable_new_by_default` - Whether newly discovered schemas/tables are
    enabled by default
  * `:schema_change_handling` - How to handle schema changes:
    * `"ALLOW_ALL"` - All new schemas/tables/columns are included
    * `"ALLOW_COLUMNS"` - New schemas/tables excluded, new columns included
    * `"BLOCK_ALL"` - All new items excluded from syncs
  * `:schemas` - Map of schema name to `Fivetrex.Models.Schema` structs

## Examples

Working with schema configuration:

    {:ok, config} = Fivetrex.Connectors.get_schema_config(client, "connector_id")

    # Iterate through enabled schemas
    for {name, schema} <- config.schemas, schema.enabled do
      IO.puts("Schema: #{name}")

      for {table_name, table} <- schema.tables, table.enabled do
        IO.puts("  Table: #{table_name}")
      end
    end

## See Also

  * `Fivetrex.Connectors.get_schema_config/2` - Fetch schema configuration
  * `Fivetrex.Connectors.update_schema_config/3` - Modify schema configuration
  * `Fivetrex.Models.Schema` - Individual schema struct

# `t`

```elixir
@type t() :: %Fivetrex.Models.SchemaConfig{
  enable_new_by_default: boolean() | nil,
  schema_change_handling: String.t() | nil,
  schemas: %{required(String.t()) =&gt; Fivetrex.Models.Schema.t()} | nil
}
```

A Fivetran Schema Configuration struct.

All fields may be `nil` if not provided in the API response.

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Converts a map (from JSON response) to a SchemaConfig struct.

Recursively parses nested schemas, tables, and columns.

## Parameters

  * `map` - A map with string keys from a decoded JSON response

## Returns

A `%Fivetrex.Models.SchemaConfig{}` struct with nested Schema structs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
