Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you learn how to rename tables and edit the schema of a table by adding, renaming, and removing columns. It outlines the implications and dependencies of table schema changes on referenced objects and mappings.
Caution
- Existing ingestions, ingestion mappings, update policies, functions, exports, materialized views, and other related operations might fail after editing the table schema. See Dependencies and make sure you edit the implementation of the ingestion mappings, update policies, functions, export, and materialized views accordingly.
Dependencies
Editing the table schema can cause ingestion and query failures due to dependencies that reference the table name or the table columns. The following matrix indicates the implications of schema edits.
| Schema edit | Dependency |
|---|---|
| Renaming tables | Materialized views: * By default, all materialized views that directly reference the old table name are updated to point to the new name, in a transactional way. * If the table name is referenced from a stored function invoked by the view query, you need to update the materialized view reference manually by using .alter materialized-view. |
| Renaming columns | * Renaming a column automatically updates all references to it in ingestion mappings. * Renaming a column preserves any existing transformations in your mappings. |
| Adding columns | * Adding a new column doesn't automatically update ingestion mappings. If you want the new column to be included, you must manually update the mappings. * Editing the schema doesn't update the mapping of incoming data to table columns during ingestion. * After adding columns, ensure you update the mapping so data is ingested correctly. For more information about updating ingestion mapping, see .alter ingestion mapping command |
| Column type | Editing a column type isn't supported by using the Edit table schema option, as changing a column type would lead to data loss. |
| Removing columns | * Deleting a column removes the column from all ingestion mappings. * Deleting a column is irreversible and causes data loss. You can't query data in the removed column. * Caution If you delete a column, save, and then add it again, the data isn't restored. It behaves as a new column and ingestion mappings aren't updated. You need to manually update the ingestion mappings. |
Prerequisites
- A workspace with a Microsoft Fabric-enabled capacity.
- A KQL database with editing permissions
- Table schema edits aren't supported when there's an active OneLake connection. Disable OneLake availability before renaming a table or editing table columns. You can enable it later, and a new copy is saved in OneLake.
Rename a table
When you rename a table, all references to that table in your ingestion mappings automatically update. In some cases, you need to manually update table mappings and references. Before renaming a table, review Dependencies.
Browse to your desired KQL database, and in the Explorer pane, expand Tables.
Select a table from the list, and open the More menu [...].
In the Edit table schema window, edit the table name. Optionally, edit the table description.
In the Dependencies section, review the referenced objects.
By default, Auto update Materialized views is enabled. You can view the updates to the command in the Command viewer.
If necessary, disable Auto update Materialized views. Make sure you review the implications in Dependencies and manually update the table ingestion mapping if necessary.
Select Update, and in the confirmation window, enter the table name again, and select Edit table schema.
Edit table columns
When you rename or add columns to a table, all references to that table in your ingestion mappings automatically update. In some cases, you need to manually update table mappings and references. Before you edit the table columns, review Dependencies.
Browse to your desired KQL database. In the explorer pane, expand Tables.
Select a table from the list, and open the More menu [...].
To add a new column, enter a column name at the bottom of the list of columns. The column name must start with a letter, and can contain numbers, periods, hyphens, or underscores.
Select a data type for your column. The default column type is
stringbut you can change it in the dropdown menu of the Column type field.Select Add column to add more columns.
In the Dependencies section, review the referenced objects.
By default, Auto update Mappings is enabled. You can view the updates to the ingestion mapping command in the Command viewer.
If necessary, disable Auto update Mappings. Make sure you review the implications in Dependencies and manually update the table ingestion mapping if necessary.
If necessary, update the data ingestion mapping.
Related content
- Create an empty table
- Data ingestion mapping