Class GPUdbIngestor
Initializes the GPUdbIngestor instance.
Parameters
gpudb.GPUdb) –The client handle through which the ingestion process is to be conducted.
The name of the table into which records will be ingested. Must be an existing table.
gpudb.GPUdbRecordType) –The type for the records which will be ingested. Its columns must be columns of the given table, but they need not be all of them: any column of the table that this type leaves out is populated by the server from that column’s own default value (‘default’, ‘init_with_now’ or ‘init_with_uuid’), which is how a record omits a column altogether. Leaving a column out requires a server of at least v7.2.3.18; against an older one the type must cover every column of the table.
Note that the columns are fixed for the lifetime of this object, so records that supply a column and records that leave it to its default need separate ingestors. Note also that supplying the column with a null value is not the same as leaving it out–a null is stored as a null, and does not bring the default into play.
The size of the queues; when any queue (one per worker rank of the database server) attains the given size, the queued records will be automatically flushed. Until then, those records will be held client-side and not actually ingested. (Unless flush() is called, of course.)
Any insertion options to be passed onto the GPUdb server. Optional parameter.
GPUdbWorkerList) –Optional parameter. A list of GPUdb worker rank addresses.
Optional boolean flag indicating whether the table is replicated; if True, then multi-head ingestion will not be used (but the head node would be used for ingestion instead). This is due to GPUdb not supporting multi-head ingestion on replicated tables.
Indicates whether the GPUdbIngestor instance is being used to insert JSON records or not. Default has been set to False. To use GPUdbIngestor for inserting JSON records it must be set to True.
Example
Return the instance of GPUdb client used by this ingestor.
Return the number of times ingestion will be attempted upon failure.
Return the GPUdb table associated with this ingestor.
Return the batch_size used for this ingestor.
Return the options used for this ingestor.
Return the number of records inserted thus far.
Return the number of records updated thus far.
Set the log level for the GPUdb multi-head I/O module.
Parameters
A valid log level for the logging module
Queues a record for insertion into GPUdb. If the queue reaches the batch size, all records in the queue will be inserted into GPUdb before the method returns. If an error occurs while inserting the records, the records will no longer be in the queue nor in GPUdb; catch InsertionException to get the list of records that were being inserted if needed (for example, to retry).
Parameters
gpudb.GPUdbRecord, Record, or JSON) –The record to insert.
The encoding to use for the insertion. Allowed values are:
binaryjson
The default value is binary.
Indicates if the data has already been encoded (so that we don’t do double encoding). Use ONLY if the data has already been encoded. Default is True.
Raises
InserttionException –If an error occurs while inserting.
Queues a list of records for insertion into GPUdb. If any queue reaches the batch size, all records in that queue will be inserted into GPUdb before the method returns. If an error occurs while inserting the queued records, the records will no longer be in that queue nor in GPUdb; catch InsertionException to get the list of records that were being inserted (including any from the queue in question and any remaining in the list not yet queued) if needed (for example, to retry). Note that depending on the number of records, multiple calls to GPUdb may occur.
Parameters
gpudb.GPUdbRecord, Record, or JSON) –The record(s) to insert.
The encoding to use for the insertion. Allowed values are:
binaryjson
The default value is binary.
Indicates if the data has already been encoded (so that we don’t do double encoding). Use ONLY if the data has already been encoded. Default is True.
Raises
InsertionException –If an error occurs while inserting
Ensures that any queued records are inserted into GPUdb. If an error occurs while inserting the records from any queue, the records will no longer be in that queue nor in GPUdb; catch InsertionException to get the list of records that were being inserted if needed (for example, to retry). Other queues may also still contain unflushed records if this occurs.
Parameters
Boolean flag indicating whether a user invoked this method or an internal method called it.
Indicates if the data has already been encoded (so that we don’t do double encoding). Use ONLY if the data has already been encoded. Default is True.
Raises
InsertionException –If an error occurs while inserting records.