@@ -244,6 +244,23 @@ describe("ExecutionAPI: native routes", () => {
244244 const expectedRows = [ "number\n" , "2\n" ] ;
245245 expect ( resultCSV . data ) . toEqual ( expectedRows . join ( "" ) ) ;
246246 } ) ;
247+
248+ it ( "executes raw SQL with executeSql" , async ( ) => {
249+ const execution = await client . executeSql ( {
250+ sql : "SELECT * FROM dex.trades WHERE block_time > now() - interval '1' day LIMIT 10" ,
251+ } ) ;
252+ expect ( execution . execution_id ) . not . toEqual ( null ) ;
253+ expect ( execution . state ) . toBeDefined ( ) ;
254+ } ) ;
255+
256+ it ( "executes raw SQL with performance parameter" , async ( ) => {
257+ const execution = await client . executeSql ( {
258+ sql : "SELECT 1 as test_value" ,
259+ performance : QueryEngine . Medium ,
260+ } ) ;
261+ expect ( execution . execution_id ) . not . toEqual ( null ) ;
262+ expect ( execution . state ) . toBeDefined ( ) ;
263+ } ) ;
247264} ) ;
248265
249266describe ( "ExecutionAPI: Errors" , ( ) => {
@@ -306,7 +323,7 @@ describe("ExecutionAPI: Errors", () => {
306323 // Create a query with intentionally bad SQL
307324 const queryId = await fullClient . query . createQuery ( {
308325 name : "Test Failed Query" ,
309- query_sql : "SELECT x" , // This will fail - column x doesn't exist
326+ query_sql : "SELECT x" ,
310327 is_private : true ,
311328 } ) ;
312329
@@ -317,13 +334,18 @@ describe("ExecutionAPI: Errors", () => {
317334 // Wait a bit for it to fail
318335 await sleep ( 3 ) ;
319336
320- // Get the results - should have an error
321- const result = await fullClient . exec . getExecutionResults ( execution . execution_id ) ;
337+ // Get the status - should have an error
338+ const status = await fullClient . exec . getExecutionStatus ( execution . execution_id ) ;
339+ expect ( status . error ) . toBeDefined ( ) ;
340+ expect ( status . error ?. type ) . toEqual ( "FAILED_TYPE_EXECUTION_FAILED" ) ;
341+ expect ( status . error ?. message ) . toContain ( "Column 'x' cannot be resolved" ) ;
342+ expect ( status . state ) . toEqual ( ExecutionState . FAILED ) ;
322343
323- // Verify error structure exists
344+ // Get the results - should also have an error
345+ const result = await fullClient . exec . getExecutionResults ( execution . execution_id ) ;
324346 expect ( result . error ) . toBeDefined ( ) ;
325347 expect ( result . error ?. type ) . toEqual ( "FAILED_TYPE_EXECUTION_FAILED" ) ;
326- expect ( result . error ?. message ) . toContain ( "x " ) ;
348+ expect ( result . error ?. message ) . toContain ( "Column 'x' cannot be resolved " ) ;
327349 expect ( result . state ) . toEqual ( ExecutionState . FAILED ) ;
328350 } finally {
329351 // Cleanup: archive the query even if test fails
0 commit comments