def get_sql(self):
        alias = self.get_alias()
        if alias:
            if self.cast:
                return 'CAST({0} AS {1}) AS {2}'.format(self.get_select_sql(), self.cast.upper(), alias)
            return '{0} AS {1}'.format(self.get_select_sql(), alias)

        if self.cast:
            return 'CAST({0} AS {1})'.format(self.get_identifier(), self.cast.upper())
        return self.get_identifier()
Loads a macro (or variable) a template exports.  This can be used to
dataset/ETHPy150Open ambitioninc/django-query-builder/querybuilder/fields.py/Field.get_sql--crossover with--dataset/ETHPy150Open hhstore/flask-annotated/flask-0.5/flask/helpers.py/get_template_attribute