|
2 | 2 |
|
3 | 3 | from sql_metadata.parser import Parser
|
4 | 4 |
|
| 5 | + |
5 | 6 | @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 | + ], |
13 | 30 | )
|
14 | 31 | def test_simple_queries_tables(query, expected):
|
15 | 32 | assert Parser(query).tables == expected
|
|
0 commit comments