@reflection.cache
def get_view_definition(self, connection, view_name, schema=None, **kw):
    if (schema is not None):
        qschema = self.identifier_preparer.quote_identifier(schema)
        master = ('%s.sqlite_master' % qschema)
        s = ("SELECT sql FROM %s WHERE name = ? AND type='view'" % (master,))
        rs = connection.exec_driver_sql(s, (view_name,))
    else:
        try:
            s = "SELECT sql FROM  (SELECT * FROM sqlite_master UNION ALL   SELECT * FROM sqlite_temp_master) WHERE name = ? AND type='view'"
            rs = connection.exec_driver_sql(s, (view_name,))
        except exc.DBAPIError:
            s = "SELECT sql FROM sqlite_master WHERE name = ? AND type='view'"
            rs = connection.exec_driver_sql(s, (view_name,))
    result = rs.fetchall()
    if result:
        return result[0].sql
@reflection.cache
def get_view_definition(self, connection, view_name, schema=None, **kw):
    if (schema is not None):
        qschema = self.identifier_preparer.quote_identifier(schema)
        master = ('%s.sqlite_master' % qschema)
        s = ("SELECT sql FROM %s WHERE name = ? AND type='view'" % (master,))
        rs = connection.exec_driver_sql(s, (view_name,))
    else:
        try:
            s = "SELECT sql FROM  (SELECT * FROM sqlite_master UNION ALL   SELECT * FROM sqlite_temp_master) WHERE name = ? AND type='view'"
            rs = connection.exec_driver_sql(s, (view_name,))
        except exc.DBAPIError:
            s = "SELECT sql FROM sqlite_master WHERE name = ? AND type='view'"
            rs = connection.exec_driver_sql(s, (view_name,))
    result = rs.fetchall()
    if result:
        return result[0].sql