Class BulkAPI


  • public class BulkAPI
    extends java.lang.Object
    BulkAPI contains bulk data operation.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BulkAPI​(AnalyticsClient ac, long orgId, long workspaceId)
      Creates a new BulkAPI instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void exportBulkData​(long jobId, java.io.OutputStream stream)
      Download the exported data for the mentioned job id.
      void exportBulkData​(long jobId, java.lang.String filePath)
      Download the exported data for the mentioned job id.
      void exportData​(long viewId, java.lang.String responseFormat, java.io.OutputStream stream, org.json.JSONObject config)
      Export the mentioned table (or) view data.
      void exportData​(long viewId, java.lang.String responseFormat, java.lang.String filePath, org.json.JSONObject config)
      Export the mentioned table (or) view data.
      void exportDataUsingSQL​(java.lang.String sqlQuery, java.lang.String responseFormat, java.io.OutputStream stream, org.json.JSONObject config)
      Internally used in JDBC driver
      void exportDataUsingSQL​(java.lang.String sqlQuery, java.lang.String responseFormat, java.lang.String filePath, org.json.JSONObject config)
      Internally used in JDBC driver
      org.json.JSONObject getExportJobDetails​(long jobId)
      Returns the details of the export job.
      org.json.JSONObject getImportJobDetails​(long jobId)
      Returns the details of the import job.
      org.json.JSONObject handleCustomBatchImport​(long viewId, java.lang.String filePath, org.json.JSONObject config)  
      long importBulkData​(long viewId, java.lang.String importType, java.lang.String fileType, boolean autoIdentify, java.lang.String filePath, org.json.JSONObject config)
      Asynchronously import the data contained in the mentioned file into the table.
      long importBulkDataInNewTable​(java.lang.String tableName, java.lang.String fileType, boolean autoIdentify, java.lang.String filePath, org.json.JSONObject config)
      Asynchronously create a new table and import the data contained in the mentioned file into the created table.
      org.json.JSONObject importData​(long viewId, java.lang.String importType, java.lang.String fileType, boolean autoIdentify, java.lang.String filePath, org.json.JSONObject config)
      Import the data contained in the mentioned file into the table.
      long importDataAsBatches​(long viewId, java.lang.String importType, boolean autoIdentify, java.lang.String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig)
      Asynchronously import the data contained in the mentioned file into the table.
      org.json.JSONObject importDataInNewTable​(java.lang.String tableName, java.lang.String fileType, boolean autoIdentify, java.lang.String filePath, org.json.JSONObject config)
      Create a new table and import the data contained in the mentioned file into the created table.
      long importDataInNewTableAsBatches​(java.lang.String tableName, boolean autoIdentify, java.lang.String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig)
      Create a new table and import the data contained in the mentioned file into the created table.
      org.json.JSONObject importRawData​(long viewId, java.lang.String importType, java.lang.String fileType, boolean autoIdentify, java.lang.String data, org.json.JSONObject config)
      Import the raw data provided into the table.
      org.json.JSONObject importRawDataInNewTable​(java.lang.String tableName, java.lang.String fileType, boolean autoIdentify, java.lang.String data, org.json.JSONObject config)
      Create a new table and import the raw data provided into the created table.
      long initiateBulkExport​(long viewId, java.lang.String responseFormat, org.json.JSONObject config)
      Initiate asynchronous export for the mentioned table (or) view data.
      long initiateBulkExportUsingSQL​(java.lang.String sqlQuery, java.lang.String responseFormat, org.json.JSONObject config)
      Initiate asynchronous export with the given SQL Query.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BulkAPI

        protected BulkAPI​(AnalyticsClient ac,
                          long orgId,
                          long workspaceId)
        Creates a new BulkAPI instance.
        Parameters:
        ac - AnalyticsClient instance.
        orgId - The ID of the organization.
        workspaceId - The ID of the workspace.
    • Method Detail

      • importDataInNewTable

        public org.json.JSONObject importDataInNewTable​(java.lang.String tableName,
                                                        java.lang.String fileType,
                                                        boolean autoIdentify,
                                                        java.lang.String filePath,
                                                        org.json.JSONObject config)
                                                 throws ServerException,
                                                        ParseException,
                                                        java.io.IOException,
                                                        org.json.JSONException
        Create a new table and import the data contained in the mentioned file into the created table.
        Parameters:
        tableName - Name of the new table to be created.
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A JSONObject of import result.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importData

        public org.json.JSONObject importData​(long viewId,
                                              java.lang.String importType,
                                              java.lang.String fileType,
                                              boolean autoIdentify,
                                              java.lang.String filePath,
                                              org.json.JSONObject config)
                                       throws ServerException,
                                              ParseException,
                                              java.io.IOException,
                                              org.json.JSONException
        Import the data contained in the mentioned file into the table.
        Parameters:
        viewId - Id of the view where the data to be imported.
        importType - The type of import. Can be one of
        • append
        • truncateadd
        • updateadd
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A JSONObject of import result.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importRawDataInNewTable

        public org.json.JSONObject importRawDataInNewTable​(java.lang.String tableName,
                                                           java.lang.String fileType,
                                                           boolean autoIdentify,
                                                           java.lang.String data,
                                                           org.json.JSONObject config)
                                                    throws ServerException,
                                                           ParseException,
                                                           java.io.IOException,
                                                           org.json.JSONException
        Create a new table and import the raw data provided into the created table.
        Parameters:
        tableName - Name of the new table to be created.
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        data - Raw data to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A JSONObject of import result.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importRawData

        public org.json.JSONObject importRawData​(long viewId,
                                                 java.lang.String importType,
                                                 java.lang.String fileType,
                                                 boolean autoIdentify,
                                                 java.lang.String data,
                                                 org.json.JSONObject config)
                                          throws ServerException,
                                                 ParseException,
                                                 java.io.IOException,
                                                 org.json.JSONException
        Import the raw data provided into the table.
        Parameters:
        viewId - Id of the view where the data to be imported.
        importType - The type of import. Can be one of
        • APPEND
        • TRUNCATEADD
        • UPDATEADD
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        data - Raw data to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A JSONObject of import result.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importBulkDataInNewTable

        public long importBulkDataInNewTable​(java.lang.String tableName,
                                             java.lang.String fileType,
                                             boolean autoIdentify,
                                             java.lang.String filePath,
                                             org.json.JSONObject config)
                                      throws ServerException,
                                             ParseException,
                                             java.io.IOException,
                                             org.json.JSONException
        Asynchronously create a new table and import the data contained in the mentioned file into the created table.
        Parameters:
        tableName - Name of the new table to be created.
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A long of the job id created.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importBulkData

        public long importBulkData​(long viewId,
                                   java.lang.String importType,
                                   java.lang.String fileType,
                                   boolean autoIdentify,
                                   java.lang.String filePath,
                                   org.json.JSONObject config)
                            throws ServerException,
                                   ParseException,
                                   java.io.IOException,
                                   org.json.JSONException
        Asynchronously import the data contained in the mentioned file into the table.
        Parameters:
        viewId - Id of the view where the data to be imported.
        importType - The type of import. Can be one of
        • APPEND
        • TRUNCATEADD
        • UPDATEADD
        fileType - Type of the file to be imported.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        config - Contains any additional control configurations. Can be null.
        Returns:
        A long of job id created.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • getImportJobDetails

        public org.json.JSONObject getImportJobDetails​(long jobId)
                                                throws ServerException,
                                                       ParseException,
                                                       java.io.IOException,
                                                       org.json.JSONException
        Returns the details of the import job.
        Parameters:
        jobId - Id of the import job.
        Returns:
        A JSONObject of import result.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • exportData

        public void exportData​(long viewId,
                               java.lang.String responseFormat,
                               java.lang.String filePath,
                               org.json.JSONObject config)
                        throws ServerException,
                               ParseException,
                               java.io.IOException,
                               org.json.JSONException
        Export the mentioned table (or) view data.
        Parameters:
        viewId - Id of the view to be exported.
        responseFormat - The format in which the data is to be exported.
        filePath - Path of the file where the data exported to be stored.
        config - Contains any additional control configurations. Can be null.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • exportData

        public void exportData​(long viewId,
                               java.lang.String responseFormat,
                               java.io.OutputStream stream,
                               org.json.JSONObject config)
                        throws ServerException,
                               ParseException,
                               java.io.IOException,
                               org.json.JSONException
        Export the mentioned table (or) view data.
        Parameters:
        viewId - Id of the view to be exported.
        responseFormat - The format in which the data is to be exported.
        stream - Outputstream where the data exported to be stored.
        config - Contains any additional control configurations. Can be null.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • exportDataUsingSQL

        public void exportDataUsingSQL​(java.lang.String sqlQuery,
                                       java.lang.String responseFormat,
                                       java.io.OutputStream stream,
                                       org.json.JSONObject config)
                                throws ServerException,
                                       ParseException,
                                       java.io.IOException,
                                       org.json.JSONException
        Internally used in JDBC driver
        Throws:
        ServerException
        ParseException
        java.io.IOException
        org.json.JSONException
      • exportDataUsingSQL

        public void exportDataUsingSQL​(java.lang.String sqlQuery,
                                       java.lang.String responseFormat,
                                       java.lang.String filePath,
                                       org.json.JSONObject config)
                                throws ServerException,
                                       ParseException,
                                       java.io.IOException,
                                       org.json.JSONException
        Internally used in JDBC driver
        Throws:
        ServerException
        ParseException
        java.io.IOException
        org.json.JSONException
      • initiateBulkExport

        public long initiateBulkExport​(long viewId,
                                       java.lang.String responseFormat,
                                       org.json.JSONObject config)
                                throws ServerException,
                                       ParseException,
                                       java.io.IOException,
                                       org.json.JSONException
        Initiate asynchronous export for the mentioned table (or) view data.
        Parameters:
        viewId - Id of the view to be exported.
        responseFormat - The format in which the data is to be exported.
        config - Contains any additional control configurations. Can be null.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • initiateBulkExportUsingSQL

        public long initiateBulkExportUsingSQL​(java.lang.String sqlQuery,
                                               java.lang.String responseFormat,
                                               org.json.JSONObject config)
                                        throws ServerException,
                                               ParseException,
                                               java.io.IOException,
                                               org.json.JSONException
        Initiate asynchronous export with the given SQL Query.
        Parameters:
        sqlQuery - The SQL Query whose output is exported.
        responseFormat - The format in which the data is to be exported.
        config - Contains any additional control configurations. Can be null.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • getExportJobDetails

        public org.json.JSONObject getExportJobDetails​(long jobId)
                                                throws ServerException,
                                                       ParseException,
                                                       java.io.IOException,
                                                       org.json.JSONException
        Returns the details of the export job.
        Parameters:
        jobId - Id of the export job.
        Returns:
        A JSONObject of export job details.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • exportBulkData

        public void exportBulkData​(long jobId,
                                   java.lang.String filePath)
                            throws ServerException,
                                   ParseException,
                                   java.io.IOException,
                                   org.json.JSONException
        Download the exported data for the mentioned job id.
        Parameters:
        jobId - Id of the job to be exported.
        filePath - Path of the file where the data exported to be stored.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • exportBulkData

        public void exportBulkData​(long jobId,
                                   java.io.OutputStream stream)
                            throws ServerException,
                                   ParseException,
                                   java.io.IOException,
                                   org.json.JSONException
        Download the exported data for the mentioned job id.
        Parameters:
        jobId - Id of the job to be exported.
        stream - Outputstream where the data exported to be stored.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
      • importDataInNewTableAsBatches

        public long importDataInNewTableAsBatches​(java.lang.String tableName,
                                                  boolean autoIdentify,
                                                  java.lang.String filePath,
                                                  int batchSize,
                                                  org.json.JSONObject config,
                                                  org.json.JSONObject toolConfig)
                                           throws ServerException,
                                                  ParseException,
                                                  java.io.IOException,
                                                  org.json.JSONException,
                                                  java.lang.Exception
        Create a new table and import the data contained in the mentioned file into the created table.
        Parameters:
        tableName - Name of the new table to be created.
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        batchSize - Number of lines per batch.
        config - Contains any additional control configurations. Can be null.
        toolConfig - Contains any additional control configurations for the parser tool. Can be null.
        Returns:
        A long of the job id created.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
        java.lang.Exception
      • importDataAsBatches

        public long importDataAsBatches​(long viewId,
                                        java.lang.String importType,
                                        boolean autoIdentify,
                                        java.lang.String filePath,
                                        int batchSize,
                                        org.json.JSONObject config,
                                        org.json.JSONObject toolConfig)
                                 throws ServerException,
                                        ParseException,
                                        java.io.IOException,
                                        org.json.JSONException,
                                        java.lang.Exception
        Asynchronously import the data contained in the mentioned file into the table.
        Parameters:
        viewId - Id of the view where the data to be imported.
        importType - The type of import. Can be one of
        • APPEND
        • TRUNCATEADD
        • UPDATEADD
        autoIdentify - Used to specify whether to auto identify the CSV format.
        filePath - Path of the file to be imported.
        batchSize - Number of lines per batch.
        config - Contains any additional control configurations. Can be null.
        toolConfig - Contains any additional control configurations for the parser tool. Can be null.
        Returns:
        A long of job id created.
        Throws:
        ServerException - If the server has received the request but did not process the request, due to some error.
        ParseException - If the server has responded but the client was not able to parse the response.
        java.io.IOException - If any communication related errors like request time out occurs, when trying to contact the service.
        org.json.JSONException - If any errors while processing the JSON data.
        java.lang.Exception
      • handleCustomBatchImport

        public org.json.JSONObject handleCustomBatchImport​(long viewId,
                                                           java.lang.String filePath,
                                                           org.json.JSONObject config)
                                                    throws ServerException,
                                                           ParseException,
                                                           java.io.IOException,
                                                           org.json.JSONException,
                                                           java.lang.Exception
        Throws:
        ServerException
        ParseException
        java.io.IOException
        org.json.JSONException
        java.lang.Exception