Skip to content

Commit

Permalink
Use display module when generating CTE (#683)
Browse files Browse the repository at this point in the history
* Use display module when generating CTE

* Update test_magic_cte.py

* Keep message same

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update magic.py

* Update test_magic_cte.py

---------

Co-authored-by: Tony Kuo <[email protected]>
  • Loading branch information
tl3119 and tonykploomber authored Jul 5, 2023
1 parent 1bde7d5 commit 60c8a32
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [Fix] Fixed CI issue by updating `invalid_connection_string_duckdb` in `test_magic.py` (#631)
* [Fix] Refactored `ResultSet` to lazy loading (#470)
* [Fix] Removed `WITH` when a snippet does not have a dependency (#657)
* [Fix] Used display module when generating CTE (#649)

## 0.7.9 (2023-06-19)

Expand Down
2 changes: 1 addition & 1 deletion src/sql/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def interactive_execute_wrapper(**kwargs):
with_ = self._store.infer_dependencies(command.sql_original, args.save)
if with_:
command.set_sql_with(with_)
print(f"Generating CTE with stored snippets : {', '.join(with_)}")
display.message(f"Generating CTE with stored snippets: {', '.join(with_)}")
else:
with_ = None

Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_magic_cte.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_infer_dependencies(ip, capsys):
)

assert result == expected
assert "Generating CTE with stored snippets : author_sub" in out
assert "Generating CTE with stored snippets: author_sub" in out


def test_deprecation_warning(ip):
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_snippets_delete(ip, capsys):
)

out, _ = capsys.readouterr()
assert "Generating CTE with stored snippets : another_orders" in out
assert "Generating CTE with stored snippets: another_orders" in out
result_del = ip.run_cell(
"%sqlcmd snippets --delete-force-all another_orders"
).result
Expand Down

0 comments on commit 60c8a32

Please sign in to comment.