Releases: databrickslabs/lsql
Releases · databrickslabs/lsql
v0.16.0
- Let page name adhere to naming restrictions (#370). In this release, a new method
_clean_resource_namehas been introduced to modify resource names according to the updated naming convention, allowing only alphanumeric characters, hyphens, and underscores. Theas_lakeviewmethod in theBaseHandlerclass now uses this new method to ensure thePageclass name adheres to the new restrictions. Furthermore, test files for dashboards have been updated to reflect the change, with a new test functiontest_dashboard_metadata_as_lakeview_cleans_page_nameverifying that page names are free of special characters, and an existing test function modified to handle invalid dashboard YAML files. These changes improve consistency, reliability, and adherence to best practices in dashboard naming within the project.
Contributors: @JCZuurmond
v0.15.1
- remove duplicate changelog entry (#366). In this update, we've improved resource name validation in the
ucxproject, first introduced in version 0.14.2. The validation now restricts resource names to alphanumeric characters, hyphens, and underscores, addressing usability issues and preventing problems caused by special characters. A new internal method,_is_valid_resource_name, checks if a name is valid according to the defined pattern. TheTileMetadataclass has been updated to ensure itsidattribute follows the new validation rules, andTile,Section, andDashboardclasses now call thevalidatemethod of theTileMetadatainstance if it exists. These changes promote consistency and correctness in dashboard resources, simplifying management and interaction for users. As a part of this commit, we also removed a duplicate changelog entry related to this feature that was previously present in version 0.15.0.
Contributors: @JCZuurmond, @gueniai
v0.15.0
- Validate resource names (#357). The recent change in the
ucxproject enhances resource name validation to adhere to a new naming convention, restricting names to alphanumeric characters, hyphens, and underscores. A new method,_is_valid_resource_name(name: str) -> bool, is introduced for validating resource names, and theTileMetadataclass has been updated with a__post_init__method and avalidatemethod for validation purposes. TheTileandFilterTileclasses also receive avalidatemethod to raiseValueErrorfor invalid tiles and metadata issues. This commit introduces new tests for validating tile IDs, tile metadata, and filter specs while improving error messages for better user understanding. It also raisesValueErrorfor tiles with empty content, tiles with names containing spaces, and filter tiles with invalid widget types, ensuring stricter validation for dashboard metadata and tile metadata in theucxproject.
Contributors: @JCZuurmond, @gueniai
v0.14.1
Release v0.14.1 (#352) * Changes to work with Databricks SDK `v0.38.0` ([#350](https://github.com/databrickslabs/lsql/issues/350)). In this release, we have upgraded the Databricks SDK to version 0.38.0 from version 0.37.0 to ensure compatibility with the latest SDK and address several issues. The update includes changes to make the code compatible with the new SDK version, removing the need for `.as_dict()` method calls when creating or updating dashboards and utilizing a `sdk_dashboard` variable for interacting with the Databricks workspace. We also updated the dependencies to "databricks-labs-blueprint[yaml]" package version greater than or equal to 0.4.2 and `sqlglot` package version greater than or equal to 22.3.1. The `test_core.py` file has been updated to address multiple issues ([#349](https://github.com/databrickslabs/lsql/issues/349) to [#332](https://github.com/databrickslabs/lsql/issues/332)) related to the Databricks SDK and the `test_dashboards.py` file has been revised to work with the new SDK version. These changes improve integration with Databricks' lakeview dashboards, simplify the code, and ensure compatibility with the latest SDK version, resolving issues [#349](https://github.com/databrickslabs/lsql/issues/349) to [#332](https://github.com/databrickslabs/lsql/issues/332). * Specify the minimum required version of `databricks-sdk` as 0.37.0 ([#331](https://github.com/databrickslabs/lsql/issues/331)). In this release, we have updated the minimum required version of the `databricks-sdk` package to 0.37.0 from 0.29.0 in the `pyproject.toml` file to ensure compatibility with the latest version. This change was made necessary due to updates made in issue [#320](https://github.com/databrickslabs/lsql/issues/320). To accommodate any patch release of `databricks-sdk` with a major and minor version of 0.37, we have updated the dependency constraint to use the `~=` operator, resolving issue [#330](https://github.com/databrickslabs/lsql/issues/330). These changes are intended to enhance the compatibility and stability of our software.
v0.14.0
- Added nightly tests run at 4:45am UTC (#318). A new nightly workflow has been added to the codebase, designed to automate a series of jobs every day at 4:45am UTC on the
largerenvironment. The workflow includes permissions for writing id-tokens, accessing issues, reading contents and pull-requests. It checks out the code with a full fetch-depth, installs Python 3.10, and uses hatch 1.9.4. The key step in this workflow is the execution of nightly tests using the databrickslabs/sandbox/acceptance action, which creates issues if necessary. The workflow utilizes several secrets, including VAULT_URI, GITHUB_TOKEN, ARM_CLIENT_ID, and ARM_TENANT_ID, and sets the TEST_NIGHTLY environment variable to true. Additionally, the workflow is part of a concurrency group called "single-acceptance-job-per-repo", ensuring that only one acceptance job runs at a time per repository. - Bump codecov/codecov-action from 4 to 5 (#319). In this version update, the Codecov GitHub Action has been upgraded from 4 to 5, bringing improved functionality and new features. This new version utilizes the Codecov Wrapper to encapsulate the CLI, enabling faster updates. Additionally, an opt-out feature has been introduced for tokens in public repositories, allowing contributors and other members to upload coverage reports without requiring access to the Codecov token. The upgrade also includes changes to the arguments:
fileis now deprecated and replaced withfiles, andpluginis deprecated and replaced withplugins. New arguments have been added, includingbinary,gcov_args,gcov_executable,gcov_ignore,gcov_include,report_type,skip_validation, andswift_project. Comprehensive documentation on these changes can be found in the release notes and changelog. - Fixed
RuntimeBackendexception handling (#328). In this release, we have made significant improvements to the exception handling in theRuntimeBackendcomponent, addressing issues reported in tickets #328, #327, #326, and #325. We have updated theexecuteandfetchmethods to handle exceptions more gracefully and changed exception handling from catchingExceptionto catchingBaseExceptionfor more comprehensive error handling. Additionally, we have updated thepyproject.tomlfile to use a newer version of thedatabricks-labs-pytesterpackage (0.2.1 to 0.5.0) which may have contributed to the resolution of these issues. Furthermore, thetest_backends.pyfile has been updated to improve the readability and user-friendliness of the test output for the functions testing if aNotFound,BadRequest, orUnknownexception is raised when executing and fetching statements. Thetest_runtime_backend_use_statementsfunction has also been updated to printPASSEDorFAILEDinstead of returning those values. These changes enhance the robustness of the exception handling mechanism in theRuntimeBackendclass and update related unit tests.
Dependency updates:
- Bump codecov/codecov-action from 4 to 5 (#319).
Contributors: @nfx, @JCZuurmond, @dependabot[bot]
v0.13.0
- Added
escape_namefunction to escape individual SQL names andescape_full_namefunction to escape dot-separated full names (#316). Two new functions,escape_nameandescape_full_name, have been added to thedatabricks.labs.lsql.escapesmodule for escaping SQL names. Theescape_namefunction takes a single name as an input and returns it enclosed in backticks, whileescape_full_namehandles dot-separated full names by escaping each individual component. These functions have been ported from thedatabrickslabs/ucxrepository and are designed to provide a consistent way to escape names and full names in SQL statements, improving the robustness of the system by preventing issues caused by unescaped special characters in SQL names. The test suite includes various cases, including single names, full names with different combinations of escaped and unescaped components, and special characters, with a specific focus on the scenario where the column name contains a period. - Bump actions/checkout from 4.2.0 to 4.2.1 (#304). In this pull request, the
actions/checkoutdependency is updated from version 4.2.0 to 4.2.1 in the.github/workflows/release.ymlfile. This update includes a new feature whererefs/*are checked out by commit if provided, falling back to the ref specified by the@orhantoyuser. This change improves the flexibility of the action, allowing users to specify a commit or branch for checkout. The pull request also introduces a new contributor,@Jcambass, who added a workflow file for publishing releases to an immutable action package. The commits for this release include changes to prepare for the 4.2.1 release, add a workflow file for publishing releases, and check out otherrefs/*by commit if provided, falling back to ref. This pull request has been reviewed and approved by Dependabot. - Bump actions/checkout from 4.2.1 to 4.2.2 (#310). This is a pull request to update the
actions/checkoutdependency from version 4.2.1 to 4.2.2, which includes improvements to theurl-helper.tsfile that now utilize well-known environment variables and expanded unit test coverage for theisGhesfunction. Theactions/checkoutaction is commonly used in GitHub Actions workflows for checking out a repository at a specific commit or branch. The changes in this update are internal to theactions/checkoutaction and should not affect the functionality of the project utilizing this action. The pull request also includes details on the commits and compatibility score for the upgrade, and reviewers can manage and merge the request using Dependabot commands once the changes have been verified. - Bump databrickslabs/sandbox from acceptance/v0.3.0 to 0.3.1 (#307). In this release, the
databrickslabs/sandboxdependency has been updated from versionacceptance/v0.3.0to0.3.1. This update includes previously tagged commits, bug fixes for git-related libraries, and resolution of theunsupported protocol schemeerror. The README has been updated with more information on using thedatabricks labs sandboxcommand, and installation instructions have been improved. Additionally, there have been dependency updates forgo-gitlibraries andgolang.org/x/cryptoin the/go-libsand/runtime-packagesdirectories. New commits in this release allow larger logs from acceptance tests and implement experimental OIDC refresh functionality. Ignore conditions have been applied to prevent conflicts with previous versions of the dependency. This update is recommended for users who want to take advantage of the latest bug fixes and improvements. - Bump databrickslabs/sandbox from acceptance/v0.3.1 to 0.4.2 (#315). In this release, the
databrickslabs/sandboxdependency has been updated from versionacceptance/v0.3.1to0.4.2. This update includes bug fixes, dependency updates, and additional go-git libraries. Specifically, theRun integration testsjob in the GitHub Actions workflow has been updated to use the new version of thedatabrickslabs/sandbox/acceptanceDocker image. The updated version also includes install instructions, usage instructions in the README, and a modification to provide more git-related libraries. Additionally, there were several updates to dependencies, includinggolang.org/x/cryptoversion0.16.0to0.17.0. Dependabot, a tool that manages dependencies in GitHub projects, is responsible for the update and provides instructions for resolving any conflicts or merging the changes into the project. This update is intended to improve the functionality and reliability of thedatabrickslabs/sandboxdependency. - Deprecate
Row.as_dict()(#309). In this release, we are introducing a deprecation warning for theas_dict()method in theRowclass, which will be removed in favor of theasDict()method. This change aims to maintain consistency with Spark'sRowbehavior and prevent subtle bugs when switching between different backends. The deprecation warning will be implemented using Python's warnings mechanism, including the new annotation in Python 3.13 for static code analysis. The existing functionality of fetching values from the database throughStatementExecutionExtremains unchanged. We recommend that clients update their code to use.asDict()instead of.as_dict()to avoid any disruptions. A new test casetest_row_as_dict_deprecated()has been added to verify the deprecation warning forRow.as_dict(). - Minor improvements for
.save_table(mode="overwrite")(#298). In this release, the.save_table()method has been improved, particularly when using theoverwritemode. If no rows are supplied, the table will now be truncated, ensuring consistency with the mock backend behavior. This change has been optimized for SQL-based backends, which now perform truncation as part of the insert for the first batch. Type hints on the abstract method have been updated to match the concrete implementations. Unit tests and integration tests have been updated to cover the new functionality, and new methods have been added to test the truncation behavior in overwrite mode. These improvements enhance the consistency and efficiency of the.save_table()method when usingoverwritemode across different backends. - Updated databrickslabs/sandbox requirement to acceptance/v0.3.0 (#305). In this release, we have updated the requirement for the
databrickslabs/sandboxpackage to versionacceptance/v0.3.0in thedownstreams.ymlfile. This update is necessary to use the latest version of the package, which includes several bug fixes and dependency updates. Thedatabrickslabs/sandboxpackage is used in the acceptance tests, which are run as part of the CI/CD pipeline. It provides a set of tools and utilities for developing and testing code in a sandbox environment. The changelog for this version includes the addition of install instructions, more git-related libraries, and the modification of the README to include information about how to use it with thedatabricks labs sandboxcommand. Specifically, the version of thedatabrickslabs/sandboxpackage used in theacceptancejob has been updated fromacceptance/v0.1.4toacceptance/v0.3.0, allowing the integration tests to be run using the latest version of the package. The ignore conditions for this PR ensure that Dependabot will resolve any conflicts that may arise and can be manually triggered with the@dependabot rebasecommand.
Dependency updates:
- Bump actions/checkout from 4.2.0 to 4.2.1 (#304).
- Updated databrickslabs/sandbox requirement to acceptance/v0.3.0 (#305).
- Bump databrickslabs/sandbox from acceptance/v0.3.0 to 0.3.1 (#307).
- Bump actions/checkout from 4.2.1 to 4.2.2 (#310).
- Bump databrickslabs/sandbox from acceptance/v0.3.1 to 0.4.2 (#315).
Contributors: @dependabot[bot], @asnare, @nfx, @JCZuurmond , @larsgeorge-db
v0.12.1
- Bump actions/checkout from 4.1.7 to 4.2.0 (#295). In this version 4.2.0 release of the
actions/checkoutlibrary, the team has addedRefandCommitoutputs, which provide the ref and commit that were checked out, respectively. The update also includes dependency updates tobraces,minor-npm-dependencies,docker/build-push-action, anddocker/login-action, all of which were automatically resolved by Dependabot. These updates improve compatibility and stability for users of the library. This release is a result of contributions from new team members @yasonk and @lucacome. Users can find a detailed commit history, pull requests, and release notes in the associated links. The team strongly encourages all users to upgrade to this new version to access the latest features and improvements. - Set catalog on
SchemaDeployerto overwrite the defaulthive_metastore(#296). In this release, the default catalog forSchemaDeployerhas been changed fromhive_metastoreto a user-defined catalog, allowing for more flexibility in deploying resources to different catalogs. A new dependency,databricks-labs-pytester, has been added with a version constraint of>=0.2.1, which may indicate the introduction of new testing functionality. TheSchemaDeployerclass has been updated to accept acatalogparameter and the tests for deploying and deleting schemas, tables, and views have been updated to reflect these changes. Thetest_deploys_schema,test_deploys_dataclass, andtest_deploys_viewtests have been updated to accept ainventory_catalogparameter, and thecaplogfixture is used to capture log messages and assert that they contain the expected messages. Additionally, a new test functiontest_statement_execution_backend_overwrites_tablehas been added to thetests/integration/test_backends.pyfile to test the functionality of theStatementExecutionBackendclass in overwriting a table in the database and retrieving the correct data. Issue #294 has been resolved, and progress has been made on issue #278, but issue #280 has been marked as technical debt and issue #287 is required for the CI to pass.
Dependency updates:
- Bump actions/checkout from 4.1.7 to 4.2.0 (#295).
Contributors: @dependabot[bot], @JCZuurmond
v0.12.0
- Added method to detect rows are written to the
MockBackend(#292). In this commit, theMockBackendclass in the 'backends.py' file has been updated with a new method, 'has_rows_written_for', which allows for differentiation between a table that has never been written to and one with zero rows. This method checks if a specific table has been written to by iterating over the table stubs in the_save_tableattribute and returningTrueif the given full name matches any of the stub full names. Additionally, the class has been supplemented with therows_written_formethod, which takes a table name and mode as input and returns a list of rows written to that table in the given mode. Furthermore, several new test cases have been added to test the functionality of theMockBackendclass, including checking if thehas_rows_written_formethod correctly identifies when there are no rows written, when there are zero rows written, and when rows are written after the first and second write operations. These changes improve the overall testing coverage of the project and aid in testing the functionality of theMockBackendclass. The new methods are accompanied by documentation strings that explain their purpose and functionality.
Contributors: @JCZuurmond
v0.11.0
- Added filter spec implementation (#276). In this commit, a new
FilterHandlerclass has been introduced to handle filter files with the suffix.filter.json, which can parse filter specifications in the header of the filter file and validate the filter columns and types. The commit also adds support for three types of filters:DATE_RANGE_PICKER,MULTI_SELECT, andDROPDOWN, which can be linked with multiple visualization widgets. Additionally, aFilterTileclass has been added to theTileclass, which represents a filter tile in the dashboard and includes methods to validate the tile, create widgets, and generate filter encodings and queries. TheDashboardMetadataclass has been updated to include a new methodget_datasets()to retrieve the datasets for the dashboard. These changes enhance the functionality of the dashboard by adding support for filtering data using various filter types and linking them with multiple visualization widgets, improving the customization and interactivity of the dashboard, and making it more user-friendly and efficient. - Bugfix:
MockBackendwasn't mockingsavetableproperly when the mode isappend(#289). This release includes a bugfix and enhancements for theMockBackendcomponent, which is used to mock theSQLBackend. The.savetable()method failed to function as expected inappendmode, writing all rows to the same table instead of accumulating them. This bug has been addressed, ensuring that rows accumulate correctly inappendmode. Additionally, a new test function,test_mock_backend_save_table_overwrite(), has been added to demonstrate the corrected behavior ofoverwritemode, showing that it now replaces only the existing rows for the given table while preserving other tables' contents. The type signature for.save_table()has been updated, restricting themodeparameter to accept only two string literals:"append"and"overwrite". TheMockBackendbehavior has been updated accordingly, and rows are now filtered to exclude anyNoneorNULLvalues prior to saving. These improvements to theMockBackendfunctionality and test suite increase reliability when using theMockBackendas a testing backend for the system. - Changed filter spec to use YML instead of JSON (#290). In this release, the filter specification files have been converted from JSON to YAML format, providing a more human-readable format for the filter specifications. The schema for the filter file includes flags for column, columns, type, title, description, order, and id, with the type flag taking on values of DROPDOWN, MULTI_SELECT, or DATE_RANGE_PICKER. This change impacts the FilterHandler, is_filter method, and _from_dashboard_folder method, as well as relevant parts of the documentation. Additionally, the parsing methods have been updated to use yaml.safe_load instead of json.loads, and the is_filter method now checks for .filter.yml suffix. A new file, '00_0_date.filter.yml', has been added to the 'tests/integration/dashboards/filter_spec_basic' directory, containing a sample date filter definition. Furthermore, various tests have been added to validate filter specifications, such as checking for invalid type and both
columnandcolumnskeys being present. These updates aim to enhance readability, maintainability, and ease of use for filter configuration. - Increase testing of generic types storage (#282). A new commit enhances the testing of generic types storage by expanding the test suite to include a list of structs, ensuring more comprehensive testing of the system. The
Foostruct has been renamed toNestedfor clarity, and two new structs,NestedWithDictandNesting, have been added. TheNestingstruct contains aNestedobject, whileNestedWithDictincludes a string and an optional dictionary of strings. A new test case demonstrates appending complex types to a table by creating and saving a table with two rows, each containing aNestingstruct. The test then fetches the data and asserts the expected number of rows are returned, ensuring the proper functioning of the storage system with complex data types. - Minor Changes to avoid redundancy in code and follow code patterns (#279). In this release, we have made significant improvements to the
dashboards.pyfile to make the code more concise, maintainable, and in line with the standard library's recommended usage. Theexport_to_zipped_csvmethod has undergone major changes, including the removal of theBytesIOmodule import and the use ofStringIOfor handling strings as files. The method no longer creates a separate ZIP file for the CSV files, instead using the providedexport_path. Additionally, the method skips tiles that don't contain queries. We have also introduced a new method,dataclass_transform, which transforms a given dataclass into a new one with specific attributes and behavior. This method creates a new dataclass with a custom metaclass and adds a new method,to_dict(), which converts the instances of the new dataclass to dictionaries. These changes promote code reusability and reduce redundancy in the codebase, making it easier for software engineers to work with. - New example with bar chart in dashboards-as-code (#281). A new example of a dashboard featuring a bar chart has been added to the
dashboards-as-codefeature using the existing metadata overrides feature to support the new widget type, without bloating the TileMetadata structure. An integration test was added to demonstrate the creation of a bar chart, and the resulting dashboard can be seen in the attached screenshot. Additionally, a new SQL file has been added for theProduct Salesdashboard, showcasing sales data for different product categories. This approach can potentially be used to support other widget types such as Bar, Pivot, Area, etc. The team is encouraged to provide feedback on this proposed solution.
Contributors: @JCZuurmond, @bishwajit-db, @ericvergnaud, @jgarciaf106, @asnare
v0.10.0
- Added Functionality to export any dashboards-as-code into CSV (#269). The
DashboardMetadataclass now includes a new method,export_to_zipped_csv, which enables exporting any dashboard as CSV files in a ZIP archive. This method acceptssql_backendandexport_pathas parameters and exports dashboard queries to CSV files in the specified ZIP archive by iterating through tiles and fetching dashboard queries if the tile is a query. To ensure the proper functioning of this feature, unit tests and manual testing have been conducted. A new test,test_dashboards_export_to_zipped_csv, has been added to verify the correct export of dashboard data to a CSV file. - Added support for generic types in
SqlBackend(#272). In this release, we've added support for using rich dataclasses, including those with optional and generic types, in theSqlBackendof theStatementExecutionBackendclass. The new functionality is demonstrated in thetest_supports_complex_typesunit test, which creates aNesteddataclass containing various complex data types, such as nested dataclasses,datetimeobjects,dict,list, and optional fields. This enhancement is achieved by updating thesave_tablemethod to handle the conversion of complex dataclasses to SQL statements. To facilitate type inference, we've introduced a newStructInferenceclass that converts Python dataclasses and built-in types to their corresponding SQL Data Definition Language (DDL) representations. This addition simplifies data definition and manipulation operations while maintaining type safety and compatibility with various SQL data types.
Contributors: @jgarciaf106, @nfx