Skip to content

Commit

Permalink
resolve merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Anupam authored and Anupam committed Jun 28, 2023
2 parents 61bf355 + b202771 commit e3f589e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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 e3f589e

Please sign in to comment.