Skip to content

Commit

Permalink
fix import format problems
Browse files Browse the repository at this point in the history
  • Loading branch information
klahnakoski committed May 31, 2024
1 parent dcf057b commit 0a08be2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions mo_sql_parsing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def format(json, ansi_quotes=True, should_quote=None):
:param should_quote: Function that returns True if a string should be quoted (because contains spaces, etc)
:return: SQL string
"""
from mo_sql_parsing.sql_parser import utils as _
from mo_sql_parsing.formatting import Formatter

return Formatter(ansi_quotes, should_quote).dispatch(json)
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions tests/smoke_test2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski ([email protected])
#
from time import time
import mo_imports

# ensure first import is fast
start_import = time()
from mo_sql_parsing import format
end_time = time()
print(format({"from":"a"}))
for e in mo_imports._expectations:
print((object.__getattribute__(e, "module"), object.__getattribute__(e, "name")))

if mo_imports._monitor:
raise Exception("mo_imports._monitor should not be alive")
2 changes: 2 additions & 0 deletions tests/test_format_and_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1762,3 +1762,5 @@ def test_issue_232_within_group(self):
"from": "public.persentil",
}
self.verify_formatting(expected_sql, expected_json)

def test_issue_240_format_smoke_test(self):

0 comments on commit 0a08be2

Please sign in to comment.