Skip to content

Commit bfc1f01

Browse files
fix sea connector tests
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent adecd53 commit bfc1f01

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

examples/experimental/sea_connector_test.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"test_sea_sync_query",
1919
"test_sea_async_query",
2020
"test_sea_metadata",
21-
"test_sea_multi_chunk",
2221
]
2322

2423

@@ -28,12 +27,6 @@ def run_test_module(module_name: str) -> bool:
2827
os.path.dirname(os.path.abspath(__file__)), "tests", f"{module_name}.py"
2928
)
3029

31-
# Handle the multi-chunk test which is in the main directory
32-
if module_name == "test_sea_multi_chunk":
33-
module_path = os.path.join(
34-
os.path.dirname(os.path.abspath(__file__)), f"{module_name}.py"
35-
)
36-
3730
# Simply run the module as a script - each module handles its own test execution
3831
result = subprocess.run(
3932
[sys.executable, module_path], capture_output=True, text=True

examples/experimental/tests/test_sea_async_query.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,29 @@ def test_sea_async_query_with_cloud_fetch():
7777

7878
logger.info("Query is no longer pending, getting results...")
7979
cursor.get_async_execution_result()
80-
80+
8181
results = [cursor.fetchone()]
8282
results.extend(cursor.fetchmany(10))
8383
results.extend(cursor.fetchall())
84-
logger.info(f"{len(results)} rows retrieved against 100 requested")
84+
actual_row_count = len(results)
85+
logger.info(
86+
f"{actual_row_count} rows retrieved against {requested_row_count} requested"
87+
)
8588

8689
logger.info(
8790
f"Requested {requested_row_count} rows, received {actual_row_count} rows"
8891
)
89-
92+
9093
# Verify total row count
9194
if actual_row_count != requested_row_count:
9295
logger.error(
9396
f"FAIL: Row count mismatch. Expected {requested_row_count}, got {actual_row_count}"
9497
)
9598
return False
96-
97-
logger.info("PASS: Received correct number of rows with cloud fetch and all fetch methods work correctly")
99+
100+
logger.info(
101+
"PASS: Received correct number of rows with cloud fetch and all fetch methods work correctly"
102+
)
98103

99104
# Close resources
100105
cursor.close()
@@ -182,20 +187,25 @@ def test_sea_async_query_without_cloud_fetch():
182187
results = [cursor.fetchone()]
183188
results.extend(cursor.fetchmany(10))
184189
results.extend(cursor.fetchall())
185-
logger.info(f"{len(results)} rows retrieved against 100 requested")
190+
actual_row_count = len(results)
191+
logger.info(
192+
f"{actual_row_count} rows retrieved against {requested_row_count} requested"
193+
)
186194

187195
logger.info(
188196
f"Requested {requested_row_count} rows, received {actual_row_count} rows"
189197
)
190-
198+
191199
# Verify total row count
192200
if actual_row_count != requested_row_count:
193201
logger.error(
194202
f"FAIL: Row count mismatch. Expected {requested_row_count}, got {actual_row_count}"
195203
)
196204
return False
197205

198-
logger.info("PASS: Received correct number of rows without cloud fetch and all fetch methods work correctly")
206+
logger.info(
207+
"PASS: Received correct number of rows without cloud fetch and all fetch methods work correctly"
208+
)
199209

200210
# Close resources
201211
cursor.close()

examples/experimental/tests/test_sea_sync_query.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import logging
77
from databricks.sql.client import Connection
88

9-
logging.basicConfig(level=logging.INFO)
9+
logging.basicConfig(level=logging.DEBUG)
1010
logger = logging.getLogger(__name__)
1111

1212

@@ -62,10 +62,14 @@ def test_sea_sync_query_with_cloud_fetch():
6262
logger.info(
6363
f"Executing synchronous query with cloud fetch to generate {requested_row_count} rows"
6464
)
65+
cursor.execute(query)
6566
results = [cursor.fetchone()]
6667
results.extend(cursor.fetchmany(10))
6768
results.extend(cursor.fetchall())
68-
logger.info(f"{len(results)} rows retrieved against 100 requested")
69+
actual_row_count = len(results)
70+
logger.info(
71+
f"{actual_row_count} rows retrieved against {requested_row_count} requested"
72+
)
6973

7074
# Close resources
7175
cursor.close()

0 commit comments

Comments
 (0)