> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# gpudbingestor

> gpudbingestor — Kinetica Python API

<div className="kinetica-pydoc">
  <div itemprop="articleBody">
    <div id="class-gpudbingestor" className="section">
      <h1>Class GPUdbIngestor</h1>

      <div className="dl py class">
        <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor"> <span className="em property"><span className="k"><span className="pre">class</span></span><span className="w"> </span></span><span className="sig-prename descclassname"><span className="pre">gpudb\_multihead\_io.</span></span><span className="sig-name descname"><span className="pre">GPUdbIngestor</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">gpudb</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">table\_name</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">record\_type</span></span><span className="p"><span className="pre">:</span></span><span className="w"> </span><span className="n"><a className="reference internal" href="/content/api/python/source/gpudbrecordtype#gpudb.GPUdbRecordType" title="gpudb.GPUdbRecordType"><span className="pre">GPUdbRecordType</span></a></span></span>, <span className="em sig-param"><span className="n"><span className="pre">batch\_size</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">options</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">workers</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">is\_table\_replicated</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">False</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">json\_ingestion</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">False</span></span></span><span className="sig-paren">)</span></div>

        <div className="dd">
          <p>Initializes the GPUdbIngestor instance.</p>
          <p><strong>Parameters</strong></p>

          <blockquote>
            <div>
              <div className="dl">
                <div className="dt">gpudb (<a className="reference internal" href="/content/api/python/source/gpudb#gpudb.GPUdb" title="gpudb.GPUdb"><code className="xref py py-class docutils literal notranslate"><span className="pre">gpudb.GPUdb</span></code></a>) –</div>

                <div className="dd">
                  <p>The client handle through which the ingestion process is to be conducted.</p>
                </div>

                <div className="dt">table\_name (<span className="em">str</span>) –</div>

                <div className="dd">
                  <p>The name of the table into which records will be ingested. Must be an existing table.</p>
                </div>

                <div className="dt">record\_type (<a className="reference internal" href="/content/api/python/source/gpudbrecordtype#gpudb.GPUdbRecordType" title="gpudb.GPUdbRecordType"><code className="xref py py-class docutils literal notranslate"><span className="pre">gpudb.GPUdbRecordType</span></code></a>) –</div>

                <div className="dd">
                  <p>The type for the records which will be ingested; must match the type of the given table.</p>
                </div>

                <div className="dt">batch\_size (<span className="em">int</span>) –</div>

                <div className="dd">
                  <p>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 <a className="reference internal" href="#gpudb_multihead_io.GPUdbIngestor.flush" title="gpudb_multihead_io.GPUdbIngestor.flush"><code className="xref py py-meth docutils literal notranslate"><span className="pre">flush()</span></code></a> is called, of course.)</p>
                </div>

                <div className="dt">options (<span className="em">dict of str to str</span>) –</div>

                <div className="dd">
                  <p>Any insertion options to be passed onto the GPUdb server. Optional parameter.</p>
                </div>

                <div className="dt">workers (<a className="reference internal" href="/content/api/python/source/gpudbworkerlist#gpudb_multihead_io.GPUdbWorkerList" title="gpudb_multihead_io.GPUdbWorkerList"><code className="xref py py-class docutils literal notranslate"><span className="pre">GPUdbWorkerList</span></code></a>) –</div>

                <div className="dd">
                  <p>Optional parameter. A list of GPUdb worker rank addresses.</p>
                </div>

                <div className="dt">is\_table\_replicated (<span className="em">bool</span>) –</div>

                <div className="dd">
                  <p>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.</p>
                </div>

                <div className="dt">json\_ingestion (<span className="em">bool</span>) –</div>

                <div className="dd">
                  <p>Indicates whether the <cite>GPUdbIngestor</cite> instance is being used to insert JSON records or not. Default has been set to <cite>False</cite>. To use <cite>GPUdbIngestor</cite> for inserting JSON records it must be set to True.</p>
                  <p><cite>Example</cite></p>

                  <div className="highlight-default notranslate">
                    ```
                    gpudb_ingestor = GPUdbIngestor(gpudb, table_name, record_type, ingestor_batch_size, ingestor_options, workers, json_ingestion=True)
                    ```
                  </div>
                </div>
              </div>
            </div>
          </blockquote>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_gpudb"> <span className="sig-name descname"><span className="pre">get\_gpudb</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the instance of GPUdb client used by this ingestor.</p>
            </div>
          </div>

          <div className="dl py property">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.retry_count"> <span className="em property"><span className="k"><span className="pre">property</span></span><span className="w"> </span></span><span className="sig-name descname"><span className="pre">retry\_count</span></span></div>

            <div className="dd">
              <p>Return the number of times ingestion will be attempted upon failure.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_table_name"> <span className="sig-name descname"><span className="pre">get\_table\_name</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the GPUdb table associated with this ingestor.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_batch_size"> <span className="sig-name descname"><span className="pre">get\_batch\_size</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the batch\_size used for this ingestor.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_options"> <span className="sig-name descname"><span className="pre">get\_options</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the options used for this ingestor.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_count_inserted"> <span className="sig-name descname"><span className="pre">get\_count\_inserted</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the number of records inserted thus far.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.get_count_updated"> <span className="sig-name descname"><span className="pre">get\_count\_updated</span></span><span className="sig-paren">(</span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Return the number of records updated thus far.</p>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.set_logger_level"> <span className="sig-name descname"><span className="pre">set\_logger\_level</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">log\_level</span></span></span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Set the log level for the GPUdb multi-head I/O module.</p>
              <p><strong>Parameters</strong></p>

              <blockquote>
                <div>
                  <div className="dl simple">
                    <div className="dt">log\_level (<span className="em">int, long, or str</span>) –</div>

                    <div className="dd">
                      <p>A valid log level for the logging module</p>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.insert_record"> <span className="sig-name descname"><span className="pre">insert\_record</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">record</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">record\_encoding</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">'binary'</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">is\_data\_encoded</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">True</span></span></span><span className="sig-paren">)</span></div>

            <div className="dd">
              <p>Queues a record for insertion into GPUdb. If the queue reaches the <a className="reference internal" href="#gpudb_multihead_io.GPUdbIngestor.get_batch_size" title="gpudb_multihead_io.GPUdbIngestor.get_batch_size"><code className="xref py py-meth docutils literal notranslate"><span className="pre">batch</span> <span className="pre">size</span></code></a>, 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 <code className="xref py py-class docutils literal notranslate"><span className="pre">InsertionException</span></code> to get the list of records that were being inserted if needed (for example, to retry).</p>
              <p><strong>Parameters</strong></p>

              <blockquote>
                <div>
                  <div className="dl">
                    <div className="dt">record (list, dict, collections.OrderedDict, <a className="reference internal" href="/content/api/python/source/gpudbrecord#gpudb.GPUdbRecord" title="gpudb.GPUdbRecord"><code className="xref py py-class docutils literal notranslate"><span className="pre">gpudb.GPUdbRecord</span></code></a>, Record, or JSON) –</div>

                    <div className="dd">
                      <p>The record to insert.</p>
                    </div>

                    <div className="dt">record\_encoding (<span className="em">str</span>) –</div>

                    <div className="dd">
                      <p>The encoding to use for the insertion. Allowed values are:</p>

                      <ul className="simple">
                        <li>
                          <p><code className="docutils literal notranslate"><span className="pre">binary</span></code></p>
                        </li>

                        <li>
                          <p><code className="docutils literal notranslate"><span className="pre">json</span></code></p>
                        </li>
                      </ul>

                      <p>The default value is <code className="docutils literal notranslate"><span className="pre">binary</span></code>.</p>
                    </div>

                    <div className="dt">is\_data\_encoded (<span className="em">bool</span>) –</div>

                    <div className="dd">
                      <p>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.</p>
                    </div>
                  </div>
                </div>
              </blockquote>

              <p><strong>Raises</strong></p>

              <blockquote>
                <div>
                  <div className="dl simple">
                    <div className="dt"><code className="xref py py-class docutils literal notranslate"><span className="pre">InserttionException</span></code> –</div>

                    <div className="dd">
                      <p>If an error occurs while inserting.</p>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.insert_records"> <span className="sig-name descname"><span className="pre">insert\_records</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">records</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">record\_encoding</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">'binary'</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">is\_data\_encoded</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">True</span></span></span><span className="sig-paren">)</span> <span className="sig-return"><span className="sig-return-icon">→</span> <span className="sig-return-typehint"><span className="pre">AttrDict</span><span className="w"> </span><span className="p"><span className="pre">|</span></span><span className="w"> </span><span className="pre">None</span></span></span></div>

            <div className="dd">
              <p>Queues a list of records for insertion into GPUdb. If any queue reaches the <a className="reference internal" href="#gpudb_multihead_io.GPUdbIngestor.get_batch_size" title="gpudb_multihead_io.GPUdbIngestor.get_batch_size"><code className="xref py py-meth docutils literal notranslate"><span className="pre">batch</span> <span className="pre">size</span></code></a>, 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 <code className="xref py py-class docutils literal notranslate"><span className="pre">InsertionException</span></code> 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.</p>
              <p><strong>Parameters</strong></p>

              <blockquote>
                <div>
                  <div className="dl">
                    <div className="dt">records (list, dict, collections.OrderedDict, <a className="reference internal" href="/content/api/python/source/gpudbrecord#gpudb.GPUdbRecord" title="gpudb.GPUdbRecord"><code className="xref py py-class docutils literal notranslate"><span className="pre">gpudb.GPUdbRecord</span></code></a>, Record, or JSON) –</div>

                    <div className="dd">
                      <p>The record(s) to insert.</p>
                    </div>

                    <div className="dt">record\_encoding (<span className="em">str</span>) –</div>

                    <div className="dd">
                      <p>The encoding to use for the insertion. Allowed values are:</p>

                      <ul className="simple">
                        <li>
                          <p><code className="docutils literal notranslate"><span className="pre">binary</span></code></p>
                        </li>

                        <li>
                          <p><code className="docutils literal notranslate"><span className="pre">json</span></code></p>
                        </li>
                      </ul>

                      <p>The default value is <code className="docutils literal notranslate"><span className="pre">binary</span></code>.</p>
                    </div>

                    <div className="dt">is\_data\_encoded (<span className="em">bool</span>) –</div>

                    <div className="dd">
                      <p>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.</p>
                    </div>
                  </div>
                </div>
              </blockquote>

              <p><strong>Raises</strong></p>

              <blockquote>
                <div>
                  <div className="dl simple">
                    <div className="dt"><code className="xref py py-class docutils literal notranslate"><span className="pre">InsertionException</span></code> –</div>

                    <div className="dd">
                      <p>If an error occurs while inserting</p>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>

          <div className="dl py method">
            <div className="dt sig sig-object py" id="gpudb_multihead_io.GPUdbIngestor.flush"> <span className="sig-name descname"><span className="pre">flush</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">forced\_flush</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">True</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">is\_data\_encoded</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">True</span></span></span><span className="sig-paren">)</span> <span className="sig-return"><span className="sig-return-icon">→</span> <span className="sig-return-typehint"><span className="pre">AttrDict</span><span className="w"> </span><span className="p"><span className="pre">|</span></span><span className="w"> </span><span className="pre">None</span></span></span></div>

            <div className="dd">
              <p>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 <code className="xref py py-class docutils literal notranslate"><span className="pre">InsertionException</span></code> 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.</p>
              <p><strong>Parameters</strong></p>

              <blockquote>
                <div>
                  <div className="dl simple">
                    <div className="dt">forced\_flush (<span className="em">bool</span>) –</div>

                    <div className="dd">
                      <p>Boolean flag indicating whether a user invoked this method or an internal method called it.</p>
                    </div>

                    <div className="dt">is\_data\_encoded (<span className="em">bool</span>) –</div>

                    <div className="dd">
                      <p>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.</p>
                    </div>
                  </div>
                </div>
              </blockquote>

              <p><strong>Raises</strong></p>

              <blockquote>
                <div>
                  <div className="dl simple">
                    <div className="dt"><code className="xref py py-class docutils literal notranslate"><span className="pre">InsertionException</span></code> –</div>

                    <div className="dd">
                      <p>If an error occurs while inserting records.</p>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
