Skip to content

Commit

Permalink
Release v0.9.1 (#262)
Browse files Browse the repository at this point in the history
* Fixed dataclass field types
([#257](#257)). This PR
introduces a workaround to a Python bug affecting the
`dataclasses.fields()` function, which sometimes returns field types as
string type names instead of types. This can cause the ORM to
malfunction. The workaround involves checking if the returned `f.type`
is a string, and if so, converting it to a type by looking it up in the
`__builtins__` dictionary. This change is global and affects the
`_schema_for` function in the `backends.py` file, which is responsible
for creating a schema for a given dataclass, taking into account any
necessary type conversions. This change ensures consistent and accurate
type handling in the face of the Python bug, improving the reliability
of our ORM.
* Fixed missing EOL when formatting SQL files
([#260](#260)). In this
release, we have addressed an issue related to the inconsistent addition
of end-of-line (EOL) characters in formatted SQL files. The
`QueryTile.format()` method has been updated to ensure that an EOL
character is always added, except when the input query already ends with
a newline. This change enhances the reliability of the SQL formatting
functionality, making the output format more predictable and improving
the overall user experience. The new implementation is demonstrated in
the `test_query_format_preserves_eol()` test case, and existing test
cases have been updated to check for the presence of EOL characters,
further ensuring consistent and correct formatting.
* Fixed normalize case input in cli
([#258](#258)). In this
release, we have updated the `fmt` command in the `cli.py` file to allow
users to specify whether they want to normalize the case of SQL files
when formatting. The `normalize_case` parameter now defaults to the
string `"true"` and checks if it is in the `STRING_AFFIRMATIVES` list to
determine whether to normalize the case of SQL files. Additionally, we
have introduced a new optional `normalize_case` parameter in the
`format` method of the `dashboards.py` file in the Databricks CLI, which
normalizes the identifiers in the query to lower case when set to
`True`. We have also added support for a new `normalize_case` parameter
in the `QueryTile.format()` method, which prevents the automatic
normalization of string input to uppercase when set to `False`. This
change allows for more flexibility in handling string input and ensures
that the input string is preserved as-is. These updates improve the
functionality and usability of the open-source library, providing more
control to users over formatting and handling of string input.
  • Loading branch information
nfx authored Aug 30, 2024
1 parent 1c1d26e commit fa23371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Version changelog

## 0.9.1

* Fixed dataclass field types ([#257](https://github.com/databrickslabs/lsql/issues/257)). This PR introduces a workaround to a Python bug affecting the `dataclasses.fields()` function, which sometimes returns field types as string type names instead of types. This can cause the ORM to malfunction. The workaround involves checking if the returned `f.type` is a string, and if so, converting it to a type by looking it up in the `__builtins__` dictionary. This change is global and affects the `_schema_for` function in the `backends.py` file, which is responsible for creating a schema for a given dataclass, taking into account any necessary type conversions. This change ensures consistent and accurate type handling in the face of the Python bug, improving the reliability of our ORM.
* Fixed missing EOL when formatting SQL files ([#260](https://github.com/databrickslabs/lsql/issues/260)). In this release, we have addressed an issue related to the inconsistent addition of end-of-line (EOL) characters in formatted SQL files. The `QueryTile.format()` method has been updated to ensure that an EOL character is always added, except when the input query already ends with a newline. This change enhances the reliability of the SQL formatting functionality, making the output format more predictable and improving the overall user experience. The new implementation is demonstrated in the `test_query_format_preserves_eol()` test case, and existing test cases have been updated to check for the presence of EOL characters, further ensuring consistent and correct formatting.
* Fixed normalize case input in cli ([#258](https://github.com/databrickslabs/lsql/issues/258)). In this release, we have updated the `fmt` command in the `cli.py` file to allow users to specify whether they want to normalize the case of SQL files when formatting. The `normalize_case` parameter now defaults to the string `"true"` and checks if it is in the `STRING_AFFIRMATIVES` list to determine whether to normalize the case of SQL files. Additionally, we have introduced a new optional `normalize_case` parameter in the `format` method of the `dashboards.py` file in the Databricks CLI, which normalizes the identifiers in the query to lower case when set to `True`. We have also added support for a new `normalize_case` parameter in the `QueryTile.format()` method, which prevents the automatic normalization of string input to uppercase when set to `False`. This change allows for more flexibility in handling string input and ensures that the input string is preserved as-is. These updates improve the functionality and usability of the open-source library, providing more control to users over formatting and handling of string input.


## 0.9.0

* Added design for filter file ([#251](https://github.com/databrickslabs/lsql/issues/251)). A new feature has been added to enable the creation of filters for multiple widgets in a dashboard using a `.filter.json` file. This file allows users to specify columns to be filtered, the filter type, title, description, order, and a unique ID for each filter. Both the `column` and `columns` flags are supported, with the former taking a single string and the latter taking a list of strings. The filter type can be set to a drop-down menu or another type as desired. The `.filter.json` file schema also supports optional `title` and `description` strings, as well as `order` and `ID` flags. An example of a `.filter.json` file is provided in the commit message. Additionally, the `dashboard.yml` file documentation has been updated to include information on how to use the new `.filter.json` file.
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/lsql/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.0"
__version__ = "0.9.1"

0 comments on commit fa23371

Please sign in to comment.