Convert SQL function (that takes in 3 input parameters) to dbt macro

I am trying to convert a SQL function that has 3 input parameters to a dbt macro and looking for the best way to implement the same. So far, we have tried -

  1. using run_query -
    my expected return type is the length of against a specific model in the target table, which is coming correctly . Our return value is DECIMAL(8), we do not need the datatype but only the value - ‘8’

Here, the target database is synapse analytics. And the datatype of the column ‘length’ is smallint.