-
Notifications
You must be signed in to change notification settings - Fork 101
[FEATURE]: Connect _migrate_table_create_ctas to migrate-tables workflow #332
Copy link
Copy link
Closed
Labels
feat/workflowtriggered as a Databricks Job managed by UCXtriggered as a Databricks Job managed by UCXmigrate/managedgo/uc/upgrade Upgrade Managed Tables and Jobsgo/uc/upgrade Upgrade Managed Tables and Jobs
Description
most of the code is done in:
Diff:
ucx/src/databricks/labs/ucx/hive_metastore/table_migrate.py
Lines 286 to 299 in 9cb9dbf
| def _migrate_table_create_ctas(self, src_table: Table, rule: Rule, grants: list[Grant] | None = None): | |
| table_migrate_sql = self._get_create_ctas_sql(src_table, rule) | |
| logger.debug(f"Migrating table (Create Like) {src_table.key} to using SQL query: {table_migrate_sql}") | |
| self._backend.execute(table_migrate_sql) | |
| self._backend.execute(src_table.sql_alter_to(rule.as_uc_table_key)) | |
| self._backend.execute(src_table.sql_alter_from(rule.as_uc_table_key, self._ws.get_workspace_id())) | |
| return self._migrate_acl(src_table, rule, grants) | |
| def _get_create_ctas_sql(self, src_table: Table, rule: Rule) -> str: | |
| create_sql = ( | |
| f"CREATE TABLE IF NOT EXISTS {escape_sql_identifier(rule.as_uc_table_key)} " | |
| f"AS SELECT * FROM {src_table.safe_sql_key}" | |
| ) | |
| return create_sql |
Tasks:
- Copy this table using CTAS
- Copy the Metadata with
CREATE TABLE ... LIKE ... - Skip tables as needed based on size threshold or an exception list
- Update the source table with
upgraded_toproperty - Link it to the workflow as task
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat/workflowtriggered as a Databricks Job managed by UCXtriggered as a Databricks Job managed by UCXmigrate/managedgo/uc/upgrade Upgrade Managed Tables and Jobsgo/uc/upgrade Upgrade Managed Tables and Jobs
Type
Projects
Status
No status