<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_dependencies(sql):
 """ Return the list of variables referenced in this SQL. """

    dependencies = []
    for (_, placeholder, dollar, _) in SqlStatement._get_tokens(sql):
      if placeholder:
        variable = placeholder[1:]
        if variable not in dependencies:
          dependencies.append(variable)
      elif dollar:
        raise Exception('Invalid sql; $ with no following $ or identifier: %s.' % sql)
    return dependencies