code: def _check_query(self, query, style_cols=None):
          
          try:
              self.sql_client.send(
                  utils.minify_sql((
                      'EXPLAIN',
                      'SELECT',
                      '  {style_cols}{comma}',
                      '  the_geom, the_geom_webmercator',
                      'FROM ({query}) _wrap;',
                  )).format(query=query,
                            comma=',' if style_cols else '',
                            style_cols=(','.join(style_cols)
                                        if style_cols else '')),
                  do_post=False)
          except Exception as err:
              raise ValueError(('Layer query `{query}` and/or style column(s) '
                                '{cols} are not valid: {err}.'
                                '').format(query=query,
                                           cols=', '.join(['`{}`'.format(c)
                                                           for c in style_cols]),
                                           err=err))
docs: Checks if query from Layer or QueryLayer is valid