def get_sql_from_template()

in utils/rules_update.py [0:0]


def get_sql_from_template(query, bind_params):
  '''
  Get the Parameters Json and select the appropriate fields where single quote needs to be applied
  Input:
    query : Is the SQL Query prepared using teamplates
    bind_params : list of parameters
  Output:
    query%params : complete sql query with quotes added in appropriate location
  '''

  if not bind_params:
    return query
  params = deepcopy(bind_params)
  # Used for iterating on the key value dictionary
  for key, val in params.items():
    if "doc_type" in key or ("key" not in key and not check_float(val)):
      if "BQ_Table" in key:
        continue
      if "dim" in key:
        continue
      params[key] = quote_sql_string(val)
  return query % params