-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix boolean cli flags #235
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 tasks
❌ 35/36 passed, 1 failed, 2 skipped, 8m47s total ❌ test_dashboards_creates_dashboard_with_replace_database: databricks.sdk.errors.platform.BadRequest: [INSUFFICIENT_PERMISSIONS] Insufficient privileges: (1.233s)
Running from acceptance #339 |
nfx
approved these changes
Jul 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
nfx
added a commit
that referenced
this pull request
Jul 25, 2024
* Added publish flag to `Dashboards.create_dashboard` ([#233](#233)). In this release, we have added a `publish` flag to the `Dashboards.create_dashboard` method, allowing users to publish the dashboard upon creation, thereby resolving issue [#219](#219). This flag is included in the `labs.yml` file with a description of its functionality. Additionally, the `no-open` flag's description has been updated to specify that it prevents the dashboard from opening in the browser after creation. The `create_dashboard` function in the `cli.py` and `dashboards.py` files has been updated to include the new `publish` flag, allowing for more flexibility in how users create and manage their dashboards. The `Dashboards.create_dashboard` method now calls the `WorkspaceClient.lakeview.publish` method when the `publish` flag is set to `True`, which publishes the created dashboard. This behavior is covered in the updated tests for the method. * Fixed boolean cli flags ([#235](#235)). In this release, we have improved the handling of command-line interface (CLI) flags in the `databricks labs` command. Specifically, we have addressed the limitation that pure boolean flags are not supported. Now, when using boolean flags, the user will be prompted to confirm with a `y` or 'yes'. We have modified the `create_dashboard` command to accept string inputs for the `publish` and `no_open` flags, which are then converted to boolean values for internal use. Additionally, we have introduced a new `open-browser` command, which will open the dashboard in the browser after creating when set to `y` or 'yes'. These changes have been tested manually to ensure correct behavior. This improvement provides a more flexible input experience and better handling of boolean flags in the CLI command for software engineers using the open-source library. * Fixed format breaks widget ([#238](#238)). In this release, we've made significant changes to the 'databricks/labs/lsql' directory's 'dashboards.py' file to address formatting breaks in the widget that could occur with Call to Action (CTA) presence in a query. These changes include the addition of new class variables, including _SQL_DIALECT and _DIALECT, and their integration into existing methods such as _parse_header, validate, format, _get_abstract_syntax_tree, and replace_catalog_and_database_in_query. Furthermore, we have developed new methods for creating and deleting schemas and getting the current test purge time. We have also implemented new integration tests to demonstrate the fix for the formatting issue and added new test cases for the query handler's header-splitting functionality, query formatting, and CTE handling. These enhancements improve the library's handling of SQL queries and query tiles in the context of dashboard creation, ensuring proper parsing, formatting, and metadata extraction for a wide range of query scenarios. * Fixed replace database when catalog or database is None ([#237](#237)). In this release, we have addressed an issue where system tables disappeared in ucx dashboards when replacing the placeholder database. To rectify this, we have developed a new method, `replace_catalog_and_database_in_query`, in the `dashboards.py` file's `replace_database` function. This method checks if the catalog or database in a query match the ones to be replaced and replaces them with new ones, ensuring that system tables are not lost during the replacement process. Additionally, we have introduced new unit tests in `test_dashboards.py` to verify that queries are correctly transformed when replacing the database or catalog in the query. These tests include various scenarios, using two parametrized test functions, to ensure the correct functioning of the feature. This change provides a more robust and reliable dashboard display when replacing the placeholder database in the system.
Merged
nfx
added a commit
that referenced
this pull request
Jul 25, 2024
* Added publish flag to `Dashboards.create_dashboard` ([#233](#233)). In this release, we have added a `publish` flag to the `Dashboards.create_dashboard` method, allowing users to publish the dashboard upon creation, thereby resolving issue [#219](#219). This flag is included in the `labs.yml` file with a description of its functionality. Additionally, the `no-open` flag's description has been updated to specify that it prevents the dashboard from opening in the browser after creation. The `create_dashboard` function in the `cli.py` and `dashboards.py` files has been updated to include the new `publish` flag, allowing for more flexibility in how users create and manage their dashboards. The `Dashboards.create_dashboard` method now calls the `WorkspaceClient.lakeview.publish` method when the `publish` flag is set to `True`, which publishes the created dashboard. This behavior is covered in the updated tests for the method. * Fixed boolean cli flags ([#235](#235)). In this release, we have improved the handling of command-line interface (CLI) flags in the `databricks labs` command. Specifically, we have addressed the limitation that pure boolean flags are not supported. Now, when using boolean flags, the user will be prompted to confirm with a `y` or 'yes'. We have modified the `create_dashboard` command to accept string inputs for the `publish` and `no_open` flags, which are then converted to boolean values for internal use. Additionally, we have introduced a new `open-browser` command, which will open the dashboard in the browser after creating when set to `y` or 'yes'. These changes have been tested manually to ensure correct behavior. This improvement provides a more flexible input experience and better handling of boolean flags in the CLI command for software engineers using the open-source library. * Fixed format breaks widget ([#238](#238)). In this release, we've made significant changes to the 'databricks/labs/lsql' directory's 'dashboards.py' file to address formatting breaks in the widget that could occur with Call to Action (CTA) presence in a query. These changes include the addition of new class variables, including _SQL_DIALECT and _DIALECT, and their integration into existing methods such as _parse_header, validate, format, _get_abstract_syntax_tree, and replace_catalog_and_database_in_query. Furthermore, we have developed new methods for creating and deleting schemas and getting the current test purge time. We have also implemented new integration tests to demonstrate the fix for the formatting issue and added new test cases for the query handler's header-splitting functionality, query formatting, and CTE handling. These enhancements improve the library's handling of SQL queries and query tiles in the context of dashboard creation, ensuring proper parsing, formatting, and metadata extraction for a wide range of query scenarios. * Fixed replace database when catalog or database is None ([#237](#237)). In this release, we have addressed an issue where system tables disappeared in ucx dashboards when replacing the placeholder database. To rectify this, we have developed a new method, `replace_catalog_and_database_in_query`, in the `dashboards.py` file's `replace_database` function. This method checks if the catalog or database in a query match the ones to be replaced and replaces them with new ones, ensuring that system tables are not lost during the replacement process. Additionally, we have introduced new unit tests in `test_dashboards.py` to verify that queries are correctly transformed when replacing the database or catalog in the query. These tests include various scenarios, using two parametrized test functions, to ensure the correct functioning of the feature. This change provides a more robust and reliable dashboard display when replacing the placeholder database in the system.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix the boolean cli flags. Purely boolean flags are not supported in the
databricks labs
cli command. Therefore, we simulate flags by confirming with ay
oryes
.