|
8 | 8 | from typing import Optional |
9 | 9 |
|
10 | 10 | from tests.conftest import wait_container_ready |
| 11 | +from ydb import QueryExplainResultFormat |
11 | 12 | from ydb.query.pool import QuerySessionPool |
12 | 13 | from ydb.query.session import QuerySession, QuerySessionStateEnum |
13 | 14 | from ydb.query.transaction import QueryTxContext |
@@ -150,8 +151,8 @@ def test_no_session_leak(self, driver_sync, docker_project): |
150 | 151 | assert pool._current_size == 0 |
151 | 152 |
|
152 | 153 | docker_project.start() |
| 154 | + wait_container_ready(driver_sync) |
153 | 155 | pool.stop() |
154 | | - wait_container_ready(driver) |
155 | 156 |
|
156 | 157 | def test_execute_with_retries_async(self, pool: QuerySessionPool): |
157 | 158 | fut = pool.execute_with_retries_async("select 1;") |
@@ -209,13 +210,21 @@ def test_explain_with_retries(self, pool: QuerySessionPool): |
209 | 210 | pool.execute_with_retries("DROP TABLE IF EXISTS test_explain") |
210 | 211 | pool.execute_with_retries("CREATE TABLE test_explain (id Int64, PRIMARY KEY (id))") |
211 | 212 | try: |
212 | | - plan = pool.explain_with_retries("SELECT * FROM test_explain") |
| 213 | + |
| 214 | + plan = pool.explain_with_retries("SELECT * FROM test_explain", result_format=QueryExplainResultFormat.STR) |
| 215 | + isinstance(plan, str) |
| 216 | + assert "FullScan" in plan |
| 217 | + |
| 218 | + plan = pool.explain_with_retries("SELECT * FROM test_explain", result_format=QueryExplainResultFormat.DICT) |
| 219 | + assert isinstance(plan, dict) |
| 220 | + |
213 | 221 | plan_string = json.dumps(plan) |
214 | 222 | assert "FullScan" in plan_string |
215 | 223 |
|
216 | 224 | plan = pool.explain_with_retries( |
217 | 225 | "SELECT * FROM test_explain WHERE id = $id", |
218 | 226 | {"$id": 1}, |
| 227 | + result_format=ydb.QueryExplainResultFormat.DICT, |
219 | 228 | ) |
220 | 229 | plan_string = json.dumps(plan) |
221 | 230 | assert "Lookup" in plan_string |
|
0 commit comments