> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/modeling/develop/schema-refreshes",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Incorporating database changes with schema refreshes

> Trigger manual or scheduled schema refreshes to keep your Omni model in sync when database tables, columns, or schemas change.

export const XCircleIcon = ({label}) => {
  return <span>
      <Icon icon="circle-xmark" iconType="solid" color="#ff2465" />
      {label && ` ${label}`}
    </span>;
};

export const CheckIcon = ({label}) => {
  return <span>
      <Icon icon="circle-check" iconType="solid" color="#26bd6c" />
      {label && ` ${label}`}
    </span>;
};

Keeping your BI tool in sync with your database when schema changes occur can be a challenge. As such, there may be times when you need to manually refresh the schema model - or make Omni aware of the changes - that your Omni model is built on.

## Requirements

To trigger schema refreshes, you'll need **Modeler** or **Connection Admin** permissions:

* **Modelers** can perform schema refreshes on connections with exactly **one** shared model
* **Connection Admins** can refresh schemas on any connection they are an admin of, whether the connection has one or multiple models

This implementation is designed to provide more flexibility to organizations whose Modelers maintain a connection's only shared model. As refreshes to multi-model connections affect every shared model on the connection, connections with more than one model can only be refreshed by Connection Admins.

## Triggering schema refreshes

Schema refreshes can be triggered manually, automated on a schedule, or via API. When you kick off a refresh, this starts a job that runs in the background. This can take several minutes depending on the size of the database.

There are two types of schema refreshes:

| Type             | Summary                            | What will be reflected in Omni?                                                                                           |
| ---------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Hard refresh** | Incorporates all changes           | <CheckIcon label="New objects" /><br /><CheckIcon label="Updated objects" /><br /><CheckIcon label="Removed objects" />   |
| **Soft refresh** | Incorporates only additive changes | <CheckIcon label="New objects" /><br /><CheckIcon label="Updated objects" /><br /><XCircleIcon label="Removed objects" /> |

<Note>
  Performing a schema refresh for dbt differs slightly than those performed on a "regular" database schema. Specifically, Omni will:

  * Search the schema for views that correspond to dbt models and add dbt metadata to them
  * If available, generate primary key definitions and relationships based on constraints
</Note>

### Hard refreshes

<Tip>
  Hard refreshes of the entire model are required to remove dropped schemas and tables in the Omni model.
</Tip>

Hard refreshes are typically performed manually. To trigger this type of refresh:

* Use **Model > Refresh schema** in the model IDE. **Note**: Performing a hard refresh with this option requires that you refresh **the entire model**. Specifying individual schemas or tables will perform a [soft refresh](#soft-refreshes).
* Navigate to **Settings > Connections**, open the connection, and click **Refresh now**
* Use the [Refresh schema API](/api/models/refresh-schema)

### Soft refreshes

Soft refreshes include scheduled refreshes and selectively refreshing schemas and tables.

<AccordionGroup>
  <Accordion title="Scheduling refreshes" icon="calendar-days">
    To schedule a refresh, navigate to **Settings > Connections** and open a connection. Click the **Schedule** button to define a cron schedule to refresh the connection's schema.

    <Tip>
      Omni uses Amazon Web Services (AWS) syntax for cron expressions. Refer to the [AWS documentation](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-scheduled-rule-pattern.html) for more information and examples.
    </Tip>

    If your organization has [AI enabled](/ai/settings/features), you can use the AI cron generator to create cron expressions from natural language. Click the sparkle icon next to the cron input field and describe your desired schedule, such as "every day at 6am" or "every Monday and Thursday at midnight."
  </Accordion>

  <Accordion title="Refreshing specific schemas & tables" icon="list-check">
    To selectively refresh schemas and tables, navigate to **Model > Refresh schema**. In the dialog that displays, add the objects you want to refresh by listing them individually or using wildcard syntax. For example, `sales_*`.
  </Accordion>
</AccordionGroup>

## Requiring branches for schema refreshes

If you prefer to review schema changes before they impact the shared model, enable the connection's **Branch based schema refresh** setting. This will force schema refreshes to be performed in an [Omni branch](/content/develop/branch-mode) before they can be promoted to the shared model.

When this setting is enabled:

* **On-demand and scheduled refreshes will be disabled**
* **Schema refreshes can only be triggered from the IDE**. If you’re not in an existing branch, selecting **Model > Refresh schema** will prompt you to create a branch first.

<Note>
  Branch-based schema refreshes can't be enabled if a connection has multiple models or if connection environments ([dynamic connections](/connect-data/dynamic-environments)) are currently in use.
</Note>

## Resolving broken references

Changes made as a result of a schema refresh may result in broken references in Omni. Use the [Content Validator](/modeling/develop/content-validator) to identify and resolve any issues. If you need to update references after renaming tables in your database, use [table migration](/modeling/develop/table-migration).
