78
78
},
79
79
],
80
80
}
81
- with TestClient (app ) as client :
82
81
83
- @pytest .fixture
84
- def manifest_hash (web_server ):
85
- return web_server .register_mdl (manifest )
86
82
87
- def test_analysis_sql_select_all_customer (manifest_hash ):
83
+ @pytest .fixture
84
+ def manifest_str (web_server ):
85
+ return web_server .register_mdl (manifest )
86
+
87
+
88
+ with TestClient (app ) as client :
89
+
90
+ def test_analysis_sql_select_all_customer (manifest_str ):
88
91
result = get_sql_analysis (
89
- {"manifestStr" : manifest_hash , "sql" : "SELECT * FROM customer" }
92
+ {"manifestStr" : manifest_str , "sql" : "SELECT * FROM customer" }
90
93
)
91
94
assert len (result ) == 1
92
95
assert result [0 ]["relation" ]["tableName" ] == "customer"
@@ -106,10 +109,10 @@ def test_analysis_sql_select_all_customer(manifest_hash):
106
109
assert result [0 ]["relation" ]["tableName" ] == "customer"
107
110
assert result [0 ]["relation" ]["nodeLocation" ] == {"line" : 1 , "column" : 15 }
108
111
109
- def test_analysis_sql_group_by_customer (manifest_hash ):
112
+ def test_analysis_sql_group_by_customer (manifest_str ):
110
113
result = get_sql_analysis (
111
114
{
112
- "manifestStr" : manifest_hash ,
115
+ "manifestStr" : manifest_str ,
113
116
"sql" : "SELECT custkey, count(*) FROM customer GROUP BY 1" ,
114
117
}
115
118
)
@@ -135,10 +138,10 @@ def test_analysis_sql_group_by_customer(manifest_hash):
135
138
],
136
139
}
137
140
138
- def test_analysis_sql_join_customer_orders (manifest_hash ):
141
+ def test_analysis_sql_join_customer_orders (manifest_str ):
139
142
result = get_sql_analysis (
140
143
{
141
- "manifestStr" : manifest_hash ,
144
+ "manifestStr" : manifest_str ,
142
145
"sql" : "SELECT * FROM customer c JOIN orders o ON c.custkey = o.custkey" ,
143
146
}
144
147
)
@@ -181,10 +184,10 @@ def test_analysis_sql_join_customer_orders(manifest_hash):
181
184
},
182
185
]
183
186
184
- def test_analysis_sql_where_clause (manifest_hash ):
187
+ def test_analysis_sql_where_clause (manifest_str ):
185
188
result = get_sql_analysis (
186
189
{
187
- "manifestStr" : manifest_hash ,
190
+ "manifestStr" : manifest_str ,
188
191
"sql" : "SELECT * FROM customer WHERE custkey = 1 OR (name = 'test' AND address = 'test')" ,
189
192
}
190
193
)
@@ -205,10 +208,10 @@ def test_analysis_sql_where_clause(manifest_hash):
205
208
]
206
209
assert result [0 ]["filter" ]["right" ]["type" ] == "AND"
207
210
208
- def test_analysis_sql_group_by_multiple_columns (manifest_hash ):
211
+ def test_analysis_sql_group_by_multiple_columns (manifest_str ):
209
212
result = get_sql_analysis (
210
213
{
211
- "manifestStr" : manifest_hash ,
214
+ "manifestStr" : manifest_str ,
212
215
"sql" : "SELECT custkey, count(*), name FROM customer GROUP BY 1, 3, nationkey" ,
213
216
}
214
217
)
@@ -251,10 +254,10 @@ def test_analysis_sql_group_by_multiple_columns(manifest_hash):
251
254
],
252
255
}
253
256
254
- def test_analysis_sql_order_by (manifest_hash ):
257
+ def test_analysis_sql_order_by (manifest_str ):
255
258
result = get_sql_analysis (
256
259
{
257
- "manifestStr" : manifest_hash ,
260
+ "manifestStr" : manifest_str ,
258
261
"sql" : "SELECT custkey, name FROM customer ORDER BY 1 ASC, 2 DESC" ,
259
262
}
260
263
)
@@ -275,10 +278,10 @@ def test_analysis_sql_order_by(manifest_hash):
275
278
assert result [0 ]["sortings" ][1 ]["ordering" ] == "DESCENDING"
276
279
assert result [0 ]["sortings" ][1 ]["nodeLocation" ] == {"line" : 1 , "column" : 52 }
277
280
278
- def test_analysis_sqls (manifest_hash ):
281
+ def test_analysis_sqls (manifest_str ):
279
282
result = get_sql_analysis_batch (
280
283
{
281
- "manifestStr" : manifest_hash ,
284
+ "manifestStr" : manifest_str ,
282
285
"sqls" : [
283
286
"SELECT * FROM customer" ,
284
287
"SELECT custkey, count(*) FROM customer GROUP BY 1" ,
0 commit comments