def query(<EOL>self, workspace_id, body, custom_headers=None, raw=False, **operation_config):
<EOL>url = self.query.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", workspace_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(body, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters)<EOL>response = self._client.send(<EOL>request, header_parameters, body_content, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>
Execute an Analytics query.

        Executes an Analytics query for data.
        [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an
        example for using POST with an Analytics query.

        :param workspace_id: ID of the workspace. This is Workspace ID from
         the Properties blade in the Azure portal.
        :type workspace_id: str
        :param body: The Analytics query. Learn more about the [Analytics
         query
         syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/)
        :type body: ~azure.loganalytics.models.QueryBody
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: QueryResults or ClientRawResponse if raw=true
        :rtype: ~azure.loganalytics.models.QueryResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<azure.loganalytics.models.ErrorResponseException>`