Creating CTAS programatically

I am trying to create a CTAS table on s3 programatically in dremio using a python function, but the execution is getting terminated prematurely without creating the CTAS,
This runs fine when I run it on the UI directly, what could be reason for the premature termination

here is my function

which is the dremio var? how are you connecting to dremio?

I am using the Dremio linux ODBC driver to establish connection with Dremio


Can you please send the profile of the on that got cancelled?

If you are using ODBC please see this post Query is getting cancelled after 30 sec when run from ODBC client - #5 by mohanmane