Updating the Query Plan

Updates the query plan of the given data provider.

The query plan represents the SQL statements that compose the query.

Request

PUT <webiURL>/documents/{documentId}/dataproviders/{dataProviderId}/queryplan

Where:

  • {documentId} is the document identifier retrieved from the list of documents
  • {dataProviderId} is the identifier of the data provider available for a document

Request body: the details of the query plan.

<queryplan custom="false" editable="true">
    ...
</queryplan>
Remember You can only update a query plan with editable attribute set to true.
Response

Response type: application/xml or application/json

The response is a message stating the success or failure of the request.

Note The custom attribute is automatically set to true once the query plan has been modified.
Restoring the Query Plan

You can revert to the original query plan by passing a request body that contains the custom attribute set to false.

<queryplan custom="false">
</queryplan>

Example

PUT <webiURL>/documents/9178/dataproviders/DP3/queryplan

Request body:

<queryplan>
    <union>
        <fullOuterJoin>
            <statement index="1">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), 
                count( distinct SALES.inv_id) FROM SALES GROUP BY 'FY' ||
                to_char(SALES.invoice_date,'yy')</statement>
            <statement index="2">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), 
                sum(INVOICE_LINE.nb_guests) FROM SALES, INVOICE_LINE, SERVICE_LINE, 
                SERVICE WHERE (SALES.INV_ID=INVOICE_LINE.INV_ID) AND 
                (INVOICE_LINE.SERVICE_ID=SERVICE.SERVICE_ID) AND 
                (SERVICE.SL_ID=SERVICE_LINE.SL_ID) AND 
                (SERVICE_LINE.service_line ='Accommodation') GROUP BY 'FY' || 
                to_char(SALES.invoice_date,'yy')</statement>
        </fullOuterJoin>
        <fullOuterJoin>
            <statement index="3">SELECT 'FY' || to_char(SALES.invoice_date,'yy'),
                count( distinct SALES.inv_id) FROM SALES GROUP BY 'FY' || 
                to_char(SALES.invoice_date,'yy')</statement>
            <statement index="4">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), 
                sum(INVOICE_LINE.days * INVOICE_LINE.nb_guests * SERVICE.price) 
                FROM SALES, INVOICE_LINE, SERVICE WHERE (SALES.INV_ID=INVOICE_LINE.INV_ID) 
                AND (INVOICE_LINE.SERVICE_ID=SERVICE.SERVICE_ID) GROUP BY 'FY' || 
                to_char(SALES.invoice_date,'yy')</statement>
        </fullOuterJoin>
    </union>
</queryplan>

Response:

<success>
    <message>The resource of type "QueryPlan" has been successfully updated.</message>
</success>