@@ -33,7 +33,9 @@ def test_sea_async_query_with_cloud_fetch():
3333
3434 try :
3535 # Create connection with cloud fetch enabled
36- logger .info ("Creating connection for asynchronous query execution with cloud fetch enabled" )
36+ logger .info (
37+ "Creating connection for asynchronous query execution with cloud fetch enabled"
38+ )
3739 connection = Connection (
3840 server_hostname = server_hostname ,
3941 http_path = http_path ,
@@ -51,30 +53,39 @@ def test_sea_async_query_with_cloud_fetch():
5153
5254 # Execute a simple query asynchronously
5355 cursor = connection .cursor ()
54- logger .info ("Executing asynchronous query with cloud fetch: SELECT 1 as test_value" )
56+ logger .info (
57+ "Executing asynchronous query with cloud fetch: SELECT 1 as test_value"
58+ )
5559 cursor .execute_async ("SELECT 1 as test_value" )
56- logger .info ("Asynchronous query submitted successfully with cloud fetch enabled" )
57-
60+ logger .info (
61+ "Asynchronous query submitted successfully with cloud fetch enabled"
62+ )
63+
5864 # Check query state
5965 logger .info ("Checking query state..." )
6066 while cursor .is_query_pending ():
6167 logger .info ("Query is still pending, waiting..." )
6268 time .sleep (1 )
63-
69+
6470 logger .info ("Query is no longer pending, getting results..." )
6571 cursor .get_async_execution_result ()
66- logger .info ("Successfully retrieved asynchronous query results with cloud fetch enabled" )
67-
72+ logger .info (
73+ "Successfully retrieved asynchronous query results with cloud fetch enabled"
74+ )
75+
6876 # Close resources
6977 cursor .close ()
7078 connection .close ()
7179 logger .info ("Successfully closed SEA session" )
72-
80+
7381 return True
7482
7583 except Exception as e :
76- logger .error (f"Error during SEA asynchronous query execution test with cloud fetch: { str (e )} " )
84+ logger .error (
85+ f"Error during SEA asynchronous query execution test with cloud fetch: { str (e )} "
86+ )
7787 import traceback
88+
7889 logger .error (traceback .format_exc ())
7990 return False
8091
@@ -100,7 +111,9 @@ def test_sea_async_query_without_cloud_fetch():
100111
101112 try :
102113 # Create connection with cloud fetch disabled
103- logger .info ("Creating connection for asynchronous query execution with cloud fetch disabled" )
114+ logger .info (
115+ "Creating connection for asynchronous query execution with cloud fetch disabled"
116+ )
104117 connection = Connection (
105118 server_hostname = server_hostname ,
106119 http_path = http_path ,
@@ -119,30 +132,39 @@ def test_sea_async_query_without_cloud_fetch():
119132
120133 # Execute a simple query asynchronously
121134 cursor = connection .cursor ()
122- logger .info ("Executing asynchronous query without cloud fetch: SELECT 1 as test_value" )
135+ logger .info (
136+ "Executing asynchronous query without cloud fetch: SELECT 1 as test_value"
137+ )
123138 cursor .execute_async ("SELECT 1 as test_value" )
124- logger .info ("Asynchronous query submitted successfully with cloud fetch disabled" )
125-
139+ logger .info (
140+ "Asynchronous query submitted successfully with cloud fetch disabled"
141+ )
142+
126143 # Check query state
127144 logger .info ("Checking query state..." )
128145 while cursor .is_query_pending ():
129146 logger .info ("Query is still pending, waiting..." )
130147 time .sleep (1 )
131-
148+
132149 logger .info ("Query is no longer pending, getting results..." )
133150 cursor .get_async_execution_result ()
134- logger .info ("Successfully retrieved asynchronous query results with cloud fetch disabled" )
135-
151+ logger .info (
152+ "Successfully retrieved asynchronous query results with cloud fetch disabled"
153+ )
154+
136155 # Close resources
137156 cursor .close ()
138157 connection .close ()
139158 logger .info ("Successfully closed SEA session" )
140-
159+
141160 return True
142161
143162 except Exception as e :
144- logger .error (f"Error during SEA asynchronous query execution test without cloud fetch: { str (e )} " )
163+ logger .error (
164+ f"Error during SEA asynchronous query execution test without cloud fetch: { str (e )} "
165+ )
145166 import traceback
167+
146168 logger .error (traceback .format_exc ())
147169 return False
148170
@@ -152,14 +174,18 @@ def test_sea_async_query_exec():
152174 Run both asynchronous query tests and return overall success.
153175 """
154176 with_cloud_fetch_success = test_sea_async_query_with_cloud_fetch ()
155- logger .info (f"Asynchronous query with cloud fetch: { '✅ PASSED' if with_cloud_fetch_success else '❌ FAILED' } " )
156-
177+ logger .info (
178+ f"Asynchronous query with cloud fetch: { '✅ PASSED' if with_cloud_fetch_success else '❌ FAILED' } "
179+ )
180+
157181 without_cloud_fetch_success = test_sea_async_query_without_cloud_fetch ()
158- logger .info (f"Asynchronous query without cloud fetch: { '✅ PASSED' if without_cloud_fetch_success else '❌ FAILED' } " )
159-
182+ logger .info (
183+ f"Asynchronous query without cloud fetch: { '✅ PASSED' if without_cloud_fetch_success else '❌ FAILED' } "
184+ )
185+
160186 return with_cloud_fetch_success and without_cloud_fetch_success
161187
162188
163189if __name__ == "__main__" :
164190 success = test_sea_async_query_exec ()
165- sys .exit (0 if success else 1 )
191+ sys .exit (0 if success else 1 )
0 commit comments