in functions/data-processing-engines/bq-saved-query-executor/main.py [0:0]
def replace_variables(file_contents, query_variables):
"""
Replaces variables in a string with their corresponding values from a dictionary.
Args:
file_contents (str): The string containing the variables to be replaced.
query_variables (dict): A dictionary mapping variable names to their values.
Returns:
str: The string with the variables replaced.
"""
for key, value in query_variables.items():
file_contents = file_contents.replace(key, f"'{value}'")
return file_contents