sqlnbfmt 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlnbfmt-0.3.1/sqlnbfmt.egg-info → sqlnbfmt-0.3.2}/PKG-INFO +1 -1
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/pyproject.toml +1 -1
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt/formatter.py +13 -5
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2/sqlnbfmt.egg-info}/PKG-INFO +1 -1
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/LICENSE +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/README.md +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/setup.cfg +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt/__init__.py +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt.egg-info/SOURCES.txt +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt.egg-info/dependency_links.txt +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt.egg-info/entry_points.txt +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt.egg-info/requires.txt +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/sqlnbfmt.egg-info/top_level.txt +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/tests/test_eval.py +0 -0
- {sqlnbfmt-0.3.1 → sqlnbfmt-0.3.2}/tests/test_formatter.py +0 -0
|
@@ -10,7 +10,7 @@ from typing import Set, Optional, Dict, Union, Tuple
|
|
|
10
10
|
|
|
11
11
|
import nbformat
|
|
12
12
|
import yaml
|
|
13
|
-
from sqlglot import
|
|
13
|
+
from sqlglot import parse, errors
|
|
14
14
|
|
|
15
15
|
DEFAULT_SQL_KEYWORDS = frozenset(
|
|
16
16
|
{
|
|
@@ -206,10 +206,18 @@ def format_sql_code(
|
|
|
206
206
|
temp_sql = temp_sql.strip()
|
|
207
207
|
|
|
208
208
|
# Parse and format SQL
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
statements = parse(temp_sql, read=dialect)
|
|
210
|
+
formatted_parts = []
|
|
211
|
+
for stmt in statements:
|
|
212
|
+
formatted_parts.append(
|
|
213
|
+
stmt.sql(
|
|
214
|
+
pretty=not force_single_line,
|
|
215
|
+
indent=config.indent_width,
|
|
216
|
+
dialect=dialect,
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
separator = "; " if force_single_line else ";\n"
|
|
220
|
+
formatted_sql = separator.join(formatted_parts)
|
|
213
221
|
|
|
214
222
|
# Apply formatting based on context
|
|
215
223
|
if is_magic_command and not is_cell_magic:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|