Skip to content

Commit 9cc8e9a

Browse files
committed
Only test for output redirect for SQL cells
1 parent 09f4fdc commit 9cc8e9a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

singlestoredb/magics/run_personal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def get_cells() -> Any:
108108
if cell.cell_type == 'code':
109109
if not cell.source.strip():
110110
continue
111-
output_redirect = getattr(
112-
cell, 'metadata', {},
113-
).get('output_variable', '') or ''
114-
if output_redirect:
115-
output_redirect = f' {output_redirect} <<'
116111
if getattr(cell, 'metadata', {}).get('language', '') == 'sql':
112+
output_redirect = getattr(
113+
cell, 'metadata', {},
114+
).get('output_variable', '') or ''
115+
if output_redirect:
116+
output_redirect = f' {output_redirect} <<'
117117
yield f'%%sql{output_redirect}\n{cell.source}'
118118
else:
119119
yield cell.source

singlestoredb/magics/run_shared.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ def get_cells() -> Any:
105105
if cell.cell_type == 'code':
106106
if not cell.source.strip():
107107
continue
108-
output_redirect = getattr(
109-
cell, 'metadata', {},
110-
).get('output_variable', '') or ''
111-
if output_redirect:
112-
output_redirect = f' {output_redirect} <<'
113108
if getattr(cell, 'metadata', {}).get('language', '') == 'sql':
109+
output_redirect = getattr(
110+
cell, 'metadata', {},
111+
).get('output_variable', '') or ''
112+
if output_redirect:
113+
output_redirect = f' {output_redirect} <<'
114114
yield f'%%sql{output_redirect}\n{cell.source}'
115115
else:
116116
yield cell.source

0 commit comments

Comments
 (0)