'how to replace to_hex from sql using python code

We have few huge bq sql scripts around 500-600 lines. in all sqls for few columns hashing is applied. we want to remove this hashing from all sql and then want to run for testing purpose. is there any way to remove such text from sql using python.

ex
select to_hex(sha256(name)),age,to_hex(sha(mobile_no)) from (select name,age,mobile_no,cast(cola as string)as col  from table2)a

in above example i can do direct replace of to_hex(sha( but removing ending bracket for this opening bracket is my blocker. anyone can guide here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source