Skip to content

Commit

Permalink
Merge pull request #110 from getindata/release-0.15.1
Browse files Browse the repository at this point in the history
Release 0.15.1
  • Loading branch information
grzegorz8 authored Nov 9, 2023
2 parents dbf7eb0 + 755d5b8 commit 165b4e1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 37 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,3 @@ jobs:
- name: Wheel
run: |
python setup.py sdist
- name: Build docker image
uses: docker/build-push-action@v3
with:
push: false
tags: getindata/streaming-jupyter-integrations:latest
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [0.15.1] - 2023-11-09

### Added

- Do not inline SQL queries. Error message shows correct line and column.

## [0.15.0] - 2023-11-02

### Added
Expand Down Expand Up @@ -255,7 +261,9 @@

- First release

[Unreleased]: https://github.com/getindata/streaming-jupyter-integrations/compare/0.15.0...HEAD
[Unreleased]: https://github.com/getindata/streaming-jupyter-integrations/compare/0.15.1...HEAD

[0.15.1]: https://github.com/getindata/streaming-jupyter-integrations/compare/0.15.0...0.15.1

[0.15.0]: https://github.com/getindata/streaming-jupyter-integrations/compare/0.14.5...0.15.0

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.15.0
current_version = 0.15.1

[tox:tox]
envlist = py38
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from setuptools import find_packages, setup
from setuptools.command.install import install

__version__ = "0.15.0"
__version__ = "0.15.1"

HERE = Path(__file__).parent.resolve()

Expand Down
6 changes: 2 additions & 4 deletions streaming_jupyter_integrations/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
from .schema_view import (IPyTreeSchemaBuilder, JsonTreeSchemaBuilder,
SchemaLoader)
from .sql_syntax_highlighting import SQLSyntaxHighlighting
from .sql_utils import (inline_sql_in_cell, is_dml, is_dql, is_metadata_query,
is_query)
from .sql_utils import is_dml, is_dql, is_metadata_query, is_query
from .variable_substitution import CellContentFormatter
from .yarn import find_session_jm_address

Expand Down Expand Up @@ -693,8 +692,7 @@ def __enrich_cell(self, cell: str) -> str:
enriched_cell = CellContentFormatter(
cell, {**os.environ, **self.shell.user_ns, **self._secrets}
).substitute_user_variables()
joined_cell = inline_sql_in_cell(enriched_cell)
return joined_cell
return enriched_cell

def __flink_execute_sql_file(self, path: Union[str, os.PathLike[str]], display_row_kind: bool) -> None:
if self.background_execution_in_progress:
Expand Down
7 changes: 0 additions & 7 deletions streaming_jupyter_integrations/sql_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@
}


def inline_sql_in_cell(cell_contents: str) -> str:
"""
Converts cell contents to a single line SQL statement.
"""
return sqlparse.format(cell_contents, strip_comments=True).replace("\n", " ")


def is_ddl(sql: str) -> bool:
return __first_token_is_keyword(sql, DDL_KEYWORDS)

Expand Down
18 changes: 1 addition & 17 deletions tests/test_sql_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest

from streaming_jupyter_integrations.sql_utils import (inline_sql_in_cell,
is_ddl, is_dml, is_dql,
from streaming_jupyter_integrations.sql_utils import (is_ddl, is_dml, is_dql,
is_metadata_query)


Expand Down Expand Up @@ -343,18 +342,3 @@ def test_non_match(self):
self.assertFalse(is_dml(non_match))
self.assertFalse(is_dql(non_match))
self.assertFalse(is_metadata_query(non_match))

def test_multiline_cell(self):
multiline_str = "CREATE TABLE multiline (\n"\
"id INT\n"\
") WITH (\n"\
"'connector'='datagen')"
self.assertEqual(inline_sql_in_cell(multiline_str),
"CREATE TABLE multiline ( id INT ) WITH ( 'connector'='datagen')")

def test_comment(self):
with_comments = "SELECT id\n"\
"--,name\n"\
"FROM table\n"\
"WHERE line = '--weird-line'"
self.assertEqual(inline_sql_in_cell(with_comments), "SELECT id FROM table WHERE line = '--weird-line'")

0 comments on commit 165b4e1

Please sign in to comment.