def sql(self, sql, parse_json=True, do_post=True, format=None):
        """
        Executes SQL query in a CartoDB server
        :param sql:
        :param parse_json: Set it to False if you want raw reponse
        :param do_post: Set it to True to force post request
        :param format: Any of the data export formats allowed by CartoDB's SQL API
        :return: response data, either as json or as a regular response.content object
        """
        params = {'q': sql}
        if format:
            params['format'] = format
            if format not in ['json', 'geojson']:
                parse_json = False
        url = self.resource_url

        # depending on query size do a POST or GET
        if len(sql) < self.MAX_GET_QUERY_LEN and not do_post:
            resp = self.req(url, 'GET', params=params)
        else:
            resp = self.req(url, 'POST', body=params)

        return self.get_response_data(resp, parse_json)
dataset/ETHPy150Open CartoDB/cartodb-python/cartodb/cartodb.py/CartoDBBase.sql/original