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. The implications and dependencies of table schema changes on referenced objects and mappings are outlined.
Caution
- Existing ingestions, ingestion mappings, update polices, 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 polices, 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 implications of schema edits are indicated in the following matrix.
Schema edit | Dependency |
---|---|
Renaming tables | Materialized views: * By default, all materialized views referencing the old table name directly 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 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 update ingestion mappings automatically. 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 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’ll 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
Renaming a table automatically updates all references to it in your ingestion mappings. In some cases, table mappings and references need manual updating. Review Dependencies before renaming a table.
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
Renaming and adding columns to a table automatically updates all references to it in your ingestion mappings. In some cases, table mappings and references need manual updating. Review Dependencies before editing the table columns.
Browse to your desired KQL database, and 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
string
but can be altered 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