v0.48.0
- Added
--dry-runoption for ACL migrate (#3017). In this release, we have added a--dry-runoption to themigrate-aclscommand in thelabs.ymlfile, enabling a preview of the migration process without executing it. This feature also introduces thehms-fedflag, allowing migration of HMS-FED ACLs while migrating tables. TheACLMigratorclass in theapplication.pyfile has been updated to include new parameters,sql_backendandinventory_database, to perform a dry run migration of Access Control Lists (ACLs). Additionally, a newretrievemethod has been added to theACLMigratorclass to retrieve a list of grants based on the source and destination objects, and aCrawlerBaseclass has been introduced for fetching grants. We have also introduced a newinferred_grantstable in the deployment schema to store inferred grants during the migration process. - Added
WorkspacePathOwnershipto determine transitive owners for files and notebooks (#3047). In this release, we introduce a new classWorkspacePathOwnershipin theowners.pymodule to determine the transitive owners for files and notebooks within a workspace. This class is added as a subclass ofOwnershipand takesAdministratorLocatorandWorkspaceClientas inputs. It has methods to infer the owner from the firstCAN_MANAGEpermission level in the access control list. We also added a new propertyworkspace_path_ownershipto the existingHiveMetastoreContextclass, which returns aWorkspacePathOwnershipobject initialized with anAdministratorLocatorobject and aworkspace_client. This addition enables the determination of owners for files and notebooks within the workspace. The functionality is demonstrated through new tests added totest_owners.py. The new tests,test_notebook_ownerandtest_file_owner, create a notebook and a workspace file and verify the owner of each using theowner_ofmethod. TheAdministratorLocatoris used to locate the administrators group for the workspace and thePermissionLevelclass is used to specify the permission level for the notebook permissions. - Added
mosaicml-streamingto known list (#3029). In this release, we have expanded the range of recognized packages in our system by adding several new libraries to the known list in the JSON file. The additions includemosaicml-streaming,oci,pynacl,pyopenssl,python-snapy, andzstd. Notably,mosaicml-streaminghas two new entries,simulationandstreaming, while the other packages have a single entry each. This update addresses issue #1931 and enhances the system's ability to identify and work with a wider variety of packages. - Added
msal-extensionsto known list (#3030). In this release, we have added support for two new packages,msal-extensionsandportalocker, to our project. Themsal-extensionspackage includes modules for extending the Microsoft Authentication Library (MSAL), including cache lock, libsecret, osx, persistence, token cache, and windows. This addition enhances the library's authentication capabilities and provides greater flexibility when working with MSAL. Theportalockerpackage offers functionalities for handling file locking with various backends such as Redis, as well as constants, exceptions, and utilities. This package enables developers to manage file locking more efficiently, preventing conflicts and ensuring data consistency. These new packages extend the range of supported packages and functionalities for handling authentication and file locking in the project, providing more options for software engineers to develop robust and secure applications. - Added
multimethodto known list (#3031). In this release, we have added support for themultimethodprogramming concept to the library. This feature has been added to theknown.jsonfile, which partially resolves issue #193 - Added
murmurhashto known list (#3032). A new hash function, MurmurHash, has been added to the library's supported list, addressing part of issue #1931. The MurmurHash function includes two variants,murmurhashand "murmurhash.about", with distinct functionalities. Themurmurhashvariant offers core hashing functionality, while "murmurhash.about" contains metadata or documentation related to the MurmurHash function. This integration enables developers to leverage MurmurHash for data processing tasks, enhancing the library's functionality and versatility. Users familiar with the project can now incorporate MurmurHash into their applications and configurations, taking advantage of its unique features and capabilities. - Added
ninjato known list (#3050). In this release, we have added Ninja to the known list in theknown.jsonfile. Ninja is a fast, lightweight build system that enables better integration and handling within the project's larger context. This change partially resolves issue #1931, which may have been caused by challenges in integrating or using Ninja. It is important to note that this change does not modify any existing functionality or introduce new methods. The alteration is limited to including Ninja in the known list, improving the management and identification of various components within the project. - Added
nvidia-ml-pyto known list (#3051). In this release, we have added support for thenvidia-ml-pypackage to our project. This addition consists of two components:exampleand 'pynvml'.Exampleis likely a placeholder or sample usage of the package, whilepynvmlis a module that enables interaction with NVIDIA's system management library (NVML) through Python. This enhancement is a significant step towards resolving issue #1931, which may require the use of NVIDIA-related tools or libraries, thereby improving the project's functionality and capabilities. - Added dashboard for tracking migration progress (#3016). This change introduces a new dashboard for tracking migration progress in a project, called "migration-progress", which displays real-time insights into migration progress and facilitates planning and task division. A new method,
_create_dashboard, has been added to generate the dashboard from SQL queries in a specified folder and replace database and catalog references to match the configuration settings. The changes include updating the install to replace the UCX catalog in queries, adding a new object serializer, and updating integration tests and manual testing on a staging environment. The new functionality covers the migration of tables, views, UDFs, grants, jobs, workflow problems, clusters, pipelines, and policies. Additionally, a new SQL file has been added to track the percentage of various objects migrated and display the results in the new dashboard. - Added grant progress encoder (#3079). A new
GrantsProgressEncoderclass has been introduced in theprogress/grants.pyfile to encodeGrantobjects intoHistoryobjects for themigration-progressworkflow. This change includes the addition of unit tests to ensure proper functionality and handles cases whereGrantobjects fail to map to the Unity Catalog by adding a list of failures to theHistoryobject. The commit also modifies themigration-progressworkflow to incorporate the newGrantsProgressEncoderclass, enhancing the grant processing capabilities and improving the testing of this functionality. This change addresses issue #3058, which was related to grant progress encoding. TheGrantsProgressEncoderclass can encode grant properties, such as the principal, action, database, schema, table, and UDF, into a format that can be written to a backend, ensuring successful migration of grants in the database. - Added table progress encoder (#3083). In this release, we've added a table progress encoder to the WorkflowTask context to enhance the tracking of table-related operations in the migration-progress workflow. This new encoder, implemented in the TableProgressEncoder class, is connected to the sql_backend, table_ownership, and migration_status_refresher objects. The GrantsProgressEncoder class has been refactored to GrantProgressEncoder, with additional parameters for improved encoding of grants. We've also introduced the refresh_table_migration_status task to scan and record the migration status of tables and views in the inventory, storing results in the $inventory.migration_status inventory table. Two new unit tests have been added to ensure proper encoding and migration status handling. This change improves progress tracking and reporting in the table migration process, addressing issues #3061 and #3064.
- Combine static code analysis results with historical job snapshots (#3074). In this release, we have added a new method,
JobsProgressEncoder, to theWorkflowTaskclass in thedatabricks.labs.ucx.contextsmodule. This method is used to track the progress of jobs in the context of a workflow task, replacing the existingjobs_progressmethod which only tracked the progress of grants. TheJobsProgressEncodermethod takes in additional arguments, includinginventory_database, to provide more detailed progress tracking for jobs and is used in thegrants_progressmethod to track the progress of jobs in the context of a workflow task. We have also added a new unit test for theJobsProgressEncoderclass in thedatabricks.labs.ucxproject to ensure that the encoding of job information works as expected with different types of failures and job details. Additionally, this revision introduces the ability to include workflow problem records in the historical job snapshots, providing additional context for debugging and analysis. TheJobsProgressEncoderclass is a subclass of theProgressEncoderclass and provides additional functionality for tracking the progress of jobs. - Connected
WorkspacePathOwnershipwithDirectFsAccessOwnership(#3049). In this revision, theDirectFsAccessCrawlerclass from thedatabricks.labs.ucx.source_code.directfs_accessmodule is imported asDirectFsAccessCrawlerandDirectFsAccessOwnership, and a newcached_propertycalleddirectfs_access_ownershipis added to theTableCrawlerclass. This property returns an instance of theDirectFsAccessOwnershipclass, which takes inadministrator_locator,workspace_path_ownership, andworkspace_clientas arguments. Additionally, theDirectFsAccessOwnershipclass has been updated to determine DirectFS access ownership for a given table and connect withWorkspacePathOwnership, enhancing the tool's functionality by determining access ownership in DirectFS and improving overall system security and permissions management. Thetest_directfs_access.pyfile has also been updated to test the ownership of query and path records using the newDirectFsAccessOwnershipobject. - Crawlers: append snapshots to history journal, if available (#2743). This commit introduces a history table to store snapshots after each crawling operation, addressing issues #2572 and #2573. The changes include the addition of a
HistoryLogclass, which handles appending inventory snapshots to the history table within a specific catalog, workspace, and run_id. The new methods also include aTableMigrationStatusclass with a new class variable__id_attributes__to specify the attributes used to uniquely identify a table. Thedestination()method has been added to theTableMigrationStatusclass to return the fully qualified name of the destination table. Additionally, unit and integration tests have been added and updated to ensure the functionality works as expected. TheTable,Job,Cluster, andUDFclasses have been updated with a newhistoryattribute to store a string representing a problem associated with the respective class. The__id_attributes__class variable has also been added to these classes to specify the attributes used to uniquely identify them. - Determine ownership of tables based on grants and source code (#3066). In this release, changes have been made to the
application.pyfile in thedatabricks/labs/ucx/contextsdirectory to improve the accuracy of determining table ownership in the inventory. A new classLegacyQueryOwnershiphas been added to thedatabricks.labs.ucx.framework.ownersmodule to determine the owner of a table based on the queries that write to it. TheTableOwnershipclass has been updated to accept additional arguments for determining ownership based on grants, queries, and workspace paths. TheDirectFsAccessOwnershipclass has also been updated to accept a newlegacy_query_ownershipargument. Additionally, a new methodowner_of_pathhas been added to theOwnershipclass, and theLegacyQueryOwnershipclass has been added as a subclass ofOwnership. A new fileownership.pyhas been introduced, which defines theTableOwnershipandTableMigrationOwnershipclasses for determining ownership of tables and table migration records in the inventory. These changes provide a more accurate and consistent ownership information for tables in the inventory. - Ensure that pipeline assessment doesn't fail if a pipeline is deleted… (#3034). In this pull request, the pipelines crawler of the DLT assessment feature has been updated to improve its resiliency in the event of a pipeline deletion during crawling. Instead of failing, the crawler now logs a warning and continues to crawl when a pipeline is deleted. A new test method,
test_pipeline_disappears_during_crawl, has been added to verify that the crawler can handle the deletion of a pipeline after listing the pipelines but before assessing them. Theassessmentandmigration-progress-experimentalworkflows have been modified, and new unit tests have been added to ensure the proper functioning of the changes. Additionally, thetest_pipeline_list_with_no_configtest case has been added to check the behavior of the pipelines crawler when there is no configuration present. This pull request aims to enhance the robustness of the assessment feature and ensure its continued operation even in the face of unexpected pipeline deletions. - Fixed
UnicodeDecodeErrorwhen fetching init scripts (#3103). In this release, we have enhanced the error handling capabilities of the open-source library by fixing aUnicodeDecodeErrorissue that occurred when fetching init scripts in the_get_init_script_datamethod. To address this, we have addedUnicodeDecodeErrorandFileNotFoundErrorto the list of exceptions handled in the method. Now, when any of these exceptions occur, the method will returnNoneand a warning message will be logged instead of raising an unhandled exception. This change ensures that the function operates smoothly and provides better error handling in the library, without modifying the behavior of the_check_cluster_init_scriptmethod, which remains unchanged and continues to verify the correct setup of init scripts in the cluster. - Fixed
UnknownHostExceptionon the specified KeyVault (#3102). In this release, we have made significant improvements to the Azure Key Vault integration, addressing issues #3102 and #3090. We have resolved anUnknownHostExceptionproblem in a specific KeyVault and implemented error handling for invalid Azure Key Vaults, ensuring more robust and reliable system behavior. Additionally, we have expandedNotFoundexception handling to include theInvalidStateexception. When the Azure Key Vault is in an invalid state, the corresponding secret will be skipped, and a warning message will be logged. This enhancement provides a more comprehensive solution to handle various exceptions that may arise when dealing with secrets stored in Azure Key Vaults. - Fixed
Unsupported schema: XXXerror onassess_workflows(#3104). The recent change to the open-source library addresses the 'Unsupported schema: XXX' error in theassess_workflowsfunction. This was achieved by introducing a new exception class, 'InvalidPath', in theWorkspaceCachemixin, and substitutingValueErrorwithInvalidPathin the 'jobs.py' file. TheInvalidPathexception is used to provide a more specific error message for unsupported schema paths. TheWorkspaceCachemixin now includes anInvalidPathexception for caching workspace paths. The error handling in the 'jobs.py' file has been modified to raiseInvalidPathinstead ofValueErrorfor better error messages. Additionally, the 'test_cached_workspace_path.py' file has updates for testing theWorkspaceCacheobject, including the addition of theInvalidPathexception for non-absolute paths, and a new test function for this exception. TheWorkspaceCacheclass has an ellipsis in the__init__method, indicating additional initialization code not shown in this diff. - Fixed
assert curr.location is not None(#3105). In this release, we have addressed a potential issue in the_external_locationsmethod which failed to check if the location of the current Hive table isNonebefore proceeding. This oversight could result in unnecessary exceptions when accessing the location of a Hive table. To rectify this, we have introduced a check forNonethat will bypass the current iteration of the loop if the location is not set, thereby improving the robustness of the code. The method continues to return a list ofExternalLocationobjects, each representing a Hive table or partition location with the corresponding number of tables or partitions present. TheExternalLocationclass remains unchanged in this commit. This improvement will ensure that the method functions smoothly and avoids errors when dealing with Hive tables that do not have a location set. - Fixed dynamic import issue (#3053). In this release, we've addressed an issue related to dynamic import inference in our open-source library. Previously, the code did not infer import names when using
importlib.import_module(some_name). This has been resolved by implementing a new method,_make_sources_for_import_call_node, which infers the import name from the provided node argument. Additionally, we've introduced new functions,get_global(self, name: str),_adjust_node_for_import_member(self, name: str, match_node: type, node: NodeNG), and updated the_matches(self, node: NodeNG, depth: int)method to handle attributes as global names. A new unit test,test_graph_imports_dynamic_import(), has been added to ensure the proper functioning of the dynamic import feature. Moreover, a new functionis_from_modulehas been introduced to check if a given name is from a specific module. This commit, co-authored by Eric Vergnaud, significantly enhances the code's ability to infer imports in dynamic import scenarios. - Fixed issue with migrating
MANAGEDhive_metastore table to UC forCONVERT_TO_EXTERNALscenario (#3020). This change updates the process for converting a managed Hive Metastore (HMS) table to external in the CONVERT_TO_EXTERNAL scenario. The functionality is split into a separate workflow task, executed from a non-Unity Catalog (UC) cluster, and is tested with unit and integration tests. The migrate table function for external sync ensures the table is migrated as external to UC post-conversion. The changes include adding a new workflow and modifying an existing one, and updates the existing workflow to rename the migrate_tables function to convert_managed_hms_to_external. The new function handles the conversion of managed HMS tables to external, and updates the object_type property of the table in the inventory database toEXTERNALafter the conversion is completed. The pull request resolves issue #2840 and removes the existing functionality of applying grants during the migration process. - Fixed issue with table location on storage root (#3094). In this release, we have implemented changes to address an issue related to the incorrect identification of the parent folder as an external location when there is a single table with a prefix that matches a parent folder. Additionally, we have improved the storage and retrieval of table locations in the root directory of a storage service by adding support for additional S3 bucket URL formats in the unit tests for the Hive Metastore. This includes handling S3 bucket URLs that do not include a specific file or path, and those with a path that does not include a file. We have also added new test cases for these URL formats and modified existing ones to include them. These changes ensure correct identification of external locations and improve functionality and flexibility of the Hive Metastore's support for external table locations. The new methods added are not explicitly stated, but they likely involve functions for parsing and processing the new S3 bucket URL formats.
- Fixed snapshot loading for DFSA and used-table crawlers (#3046). This commit resolves issues related to snapshot loading for the DFSA and used-table crawlers when using the spark-based lsql backend. The root cause was the use of
.as_dict()to convert rows to dictionaries, which is unavailable in the spark-based lsql backend. The fix involves replacing this method with.asDict(). Additionally, integration and unit tests were updated to include snapshot loading for these crawlers, and a typo in a test name was corrected. The changes are confined to the test_queries.py file and do not affect other parts of the project. No new methods were added, and existing functionality changes were limited to updating the snapshot loading process. - Ignore failed inference codes when presenting results to Databricks Runtime (#3087). In this release, the
lsp_plugin.pyfile has been updated in thedatabricks/labs/ucx/source_codedirectory to improve the user experience in the notebook editor. The changes include disabling certain advice codes from being propagated, specifically: 'cannot-autofix-table-reference', 'default-format-changed-in-dbr8', 'dependency-not-found', 'not-supported', 'notebook-run-cannot-compute-value', 'sql-parse-error', 'sys-path-cannot-compute-value', and 'unsupported-magic-line'. A new variableDEBUG_MESSAGE_CODEShas been introduced to store the list of advice codes to be ignored, and the list comprehension that createsdiagnosticsin thepylsp_lintfunction has been updated to exclude these codes. These updates aim to reduce the number of unnecessary error messages and improve the accuracy of the linter for supported codes. - Improve scan tables in mounts (#2767). In this release, the
scan-tables-in-mountsfunctionality in the hive metastore has been significantly improved, providing a more robust and comprehensive solution. Previously, the implementation skipped most directories, only finding 8 tables, but this issue has been addressed, allowing the updated version to parse many more tables. The commit includes bug fixes and the addition of new unit tests. The reviewer is encouraged to refactor the code in future iterations to use theosmodule instead ofdbutilsfor listing directories, enabling parallelization and improving scalability. The commit resolves issue #2540 and updates thescan-tables-in-mounts-experimentalworkflow. While manual and unit tests have been added and verified, integration tests are still pending implementation. The co-author of this commit is Dan Zafar. - Removed
WorkflowLinteras it is part of theAssessmentworkflow (#3036). In this release, theWorkflowLinterhas been removed as it is now integrated into theAssessmentworkflow, addressing issue #3035. This change simplifies the codebase, removing the need for a separate linter while maintaining essential functionality for ensuring Unity Catalog compatibility. The linter's functionality has been merged with other parts of the assessment workflow, with results persisted in the$inventory_database.workflow_problemsand$inventory_database.directfs_in_pathstables. Theassess_workflowsandassess_dashboardsmethods have been updated accordingly, removingWorkflowLinterusage. Additionally, theExperimentalWorkflowLinterclass has been removed from theworkflows.pyfile, along with its associated methodslint_all_workflowsandlint_all_queries. Thetest_running_real_workflow_linter_jobfunction has also been removed due to the integration of theWorkflowLinterinto theAssessmentworkflow. Manual testing has been conducted to ensure the correctness of these changes and the continued proper functioning of the assessment workflow. - Updated permissions crawling so that it doesn't fail if a secret scope disappears during crawling (#3070). This commit enhances the open-source library by updating the permissions crawling process for secret scopes, addressing the issue of task failure when a secret scope disappears before ACL retrieval. The
assessmentworkflow has been modified to incorporate these updates, and new unit tests have been added, including one that simulates the disappearance of a secret scope during crawling. ThePermissionsCrawlerclass and theThreads.gathermethod have been improved to handle such cases, logging a warning instead of failing the task. The return type of theget_crawler_tasksmethod has been updated to Iterable[Callable[[], Permissions | None]]. These changes improve the reliability and robustness of the permissions crawling process for secret scopes, ensuring task completion in the face of unexpected scope disappearances. - Updated sqlglot requirement from <25.26,>=25.5.0 to >=25.5.0,<25.27 (#3041). In this pull request, we have updated the sqlglot library requirement to incorporate the latest version, which includes various bug fixes, refactors, and exciting new features. The latest version now supports the TO_DOUBLE and TRY_TO_TIMESTAMP functions in Snowflake and the EDIT_DISTANCE (Levinshtein) function in BigQuery. Moreover, we've addressed an issue with the ARRAY JOIN function in Clickhouse and made changes to the hive dialect hierarchy. We encourage users to update to this latest version to benefit from these enhancements and fixes, ensuring optimal performance and functionality of the library.
- Updated sqlglot requirement from <25.27,>=25.5.0 to >=25.5.0,<25.28 (#3048). In this release, we have updated the requirement for the
sqlglotlibrary to a version greater than or equal to 25.5.0 and less than 25.28. This change was made to allow for the use of the latest features and bug fixes available in 'sqlglot', while avoiding the breaking changes that were introduced in version 25.27. The new version ofsqlglotoffers several improvements, including but not limited to enhanced query optimization, expanded support for various SQL dialects, and better error handling. We recommend that all users upgrade to the latest version ofsqlglotto take advantage of these new features and improvements. - Updated sqlglot requirement from <25.28,>=25.5.0 to >=25.5.0,<25.29 (#3093). This release includes an update to the
sqlglotdependency, changing the version requirement from 25.5.0 up to but excluding 25.28, to a range that includes 25.5.0 up to but excluding 25.29. This change allows for the use of the latestsqlglotversion and includes all the updates and bug fixes from this library since the previous version. The pull request provides a list of changes made insqlglotsince the previous version, as well as a list of relevant commits. Dependabot has been configured to handle any merge conflicts for this pull request and includes commands to trigger various Dependabot actions. This update was made by Dependabot and is indicated by a signed-off-by line.
Dependency updates:
- Updated sqlglot requirement from <25.26,>=25.5.0 to >=25.5.0,<25.27 (#3041).
- Updated sqlglot requirement from <25.27,>=25.5.0 to >=25.5.0,<25.28 (#3048).
- Updated sqlglot requirement from <25.28,>=25.5.0 to >=25.5.0,<25.29 (#3093).
Contributors: @nfx, @pritishpai, @JCZuurmond, @asnare, @dependabot[bot], @FastLee, @ericvergnaud, @sdanielzafar, @HariGS-DB