Skip to content

Commit 3aa9480

Browse files
author
Santos, Tyler (Boston)
committed
formatting
1 parent e60efcc commit 3aa9480

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

sql_metadata/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,9 @@ def _combine_tokens(self, index: int, value: str) -> Tuple[str, bool]:
10351035
"""
10361036
if index > 1:
10371037
prev_value = self.non_empty_tokens[index - 1]
1038-
if not self._is_token_part_of_complex_identifier(prev_value, index-1):
1038+
if not self._is_token_part_of_complex_identifier(prev_value, index - 1):
10391039
return value, False
1040-
prev_value = str(prev_value).strip('`')
1040+
prev_value = str(prev_value).strip("`")
10411041
value = f"{prev_value}{value}"
10421042
return value, True
10431043
return value, False

test/test_mssql_server.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,31 @@
22

33
from sql_metadata.parser import Parser
44

5+
56
@pytest.mark.parametrize(
6-
"query, expected",
7-
[
8-
pytest.param("SELECT * FROM mydb..test_table", ["mydb..test_table"], id='Default schema, db qualified'),
9-
pytest.param("SELECT * FROM ..test_table", ["..test_table"], id='Default schema, db unqualified'),
10-
pytest.param("SELECT * FROM [mydb].[dbo].[test_table]", ["[mydb].[dbo].[test_table]"], id='With object identifier delimiters'),
11-
pytest.param("SELECT * FROM [my_server].[mydb].[dbo].[test_table]", ["[my_server].[mydb].[dbo].[test_table]"], id='With linked-server and object identifier delimiters'),
12-
]
7+
"query, expected",
8+
[
9+
pytest.param(
10+
"SELECT * FROM mydb..test_table",
11+
["mydb..test_table"],
12+
id="Default schema, db qualified",
13+
),
14+
pytest.param(
15+
"SELECT * FROM ..test_table",
16+
["..test_table"],
17+
id="Default schema, db unqualified",
18+
),
19+
pytest.param(
20+
"SELECT * FROM [mydb].[dbo].[test_table]",
21+
["[mydb].[dbo].[test_table]"],
22+
id="With object identifier delimiters",
23+
),
24+
pytest.param(
25+
"SELECT * FROM [my_server].[mydb].[dbo].[test_table]",
26+
["[my_server].[mydb].[dbo].[test_table]"],
27+
id="With linked-server and object identifier delimiters",
28+
),
29+
],
1330
)
1431
def test_simple_queries_tables(query, expected):
1532
assert Parser(query).tables == expected

0 commit comments

Comments
 (0)