Skip to content

Commit

Permalink
Merge branch 'ploomber:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sa4084 authored Jun 28, 2023
2 parents 56aa183 + b202771 commit 1d2f1ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [Doc] Document --persist-replace in API section (#539)
* [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)

## 0.7.9 (2023-06-19)

Expand Down
3 changes: 3 additions & 0 deletions src/sql/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def __str__(self) -> str:
template = (
with_clause_template_backtick if is_use_backtick else with_clause_template
)
# return query without 'with' when no dependency exists
if len(with_all) == 0:
return self._query.strip()
return template.render(
query=self._query,
saved=self._store._data,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_magic_cte.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_snippets_delete(ip, capsys):
)
result = ip.run_cell("%sqlrender final").result
expected = (
"WITH\n\n SELECT o.order_id, customers.name, "
"SELECT o.order_id, customers.name, "
"o.order_value\n "
"FROM another_orders o\n INNER JOIN customers "
"ON o.customer_id=customers.customer_id"
Expand Down

0 comments on commit 1d2f1ca

Please sign in to comment.