code: def get_sqlview(self, uid, execute=False, var=None, criteria=None, merge=False):
          
          params = {}
          sqlview_type = self.get('sqlViews/{}'.format(uid), params={'fields': 'type'}).json().get('type')
          if sqlview_type == 'QUERY':
              if not isinstance(var, dict):
                  raise ClientException("Use a dict to submit variables: e.g. var={'key1': 'value1', 'key2': 'value2'}")
              var = ['{}:{}'.format(k, v) for k, v in var.items()]
              params['var'] = var
              if execute:
                  raise ClientException("SQL view of type QUERY, no view to create (no execute=True)")
  
          else:  # MATERIALIZED_VIEW / VIEW
              if criteria:
                  if not isinstance(criteria, dict):
                      raise ClientException("Use a dict to submit criteria: { 'col1': 'value1', 'col2': 'value2' }")
                  criteria = ['{}:{}'.format(k, v) for k, v in criteria.items()]
                  params['criteria'] = criteria
  
              if execute:  # materialize
                  self.post('sqlViews/{}/execute'.format(uid))
  
          def page_generator():
              with closing(self.get('sqlViews/{}/data'.format(uid), file_type='csv', params=params, stream=True)) as r:
                  # do not need to use unicodecsv.DictReader as data comes in bytes already
                  reader = DictReader(codecs.iterdecode(r.iter_lines(), 'utf-8'), delimiter=',', quotechar='"')
                  for row in reader:
                      yield row
  
          if not merge:
              return page_generator()
          else:
              return list(page_generator())
docs: GET SQL View data
          :param uid: sqlView UID
          :param execute: materialize sqlView before downloading its data
          :param var: for QUERY types, a dict of variables to query the sqlView
          :param criteria: for VIEW / MATERIALIZED_VIEW types, a dict of criteria to filter the sqlView
          :param merge: If true, return a list containing all pages instead of one page. Defaults to False.
          :return: a list OR generator where __next__ is a 'row' of the SQL View