> ## 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.

# get_records

<div className="kinetica-pydoc">
  <div className="dl py method">
    <div className="dt sig sig-object py" id="gpudb.GPUdb.get_records"> <span className="sig-name descname"><span className="pre">get\_records</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">table\_name</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">offset</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">0</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">limit</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">-9999</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">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">options</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">{"{"}{"}"}</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">get\_record\_type</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><a href="https://github.com/kineticadb/kinetica-api-python/blob/master/gpudb/gpudb.py#L30716"><span className="viewcode-link"><span className="pre">\[source]</span></span></a></div>

    <div className="dd">
      <p>Retrieves records from a given table, optionally filtered by an expression and/or sorted by a column. This operation can be performed on tables and views. Records can be returned encoded as binary, json, or geojson.</p>
      <p>This operation supports paging through the data via the input parameter <span className="em">offset</span> and input parameter <span className="em">limit</span> parameters. Note that when paging through a table, if the table (or the underlying table in case of a view) is updated (records are inserted, deleted or modified) the records retrieved may differ between calls based on the updates applied.</p>
      <p><strong>Parameters</strong></p>

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

            <div className="dd">
              <p>Name of the table or view from which the records will be fetched, in \[schema\_name.]table\_name format, using standard <a className="reference external" href="/content/concepts/tables/#table-name-resolution">name resolution rules</a>.</p>
            </div>

            <div className="dt">offset (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX\_INT.</p>
            </div>

            <div className="dt">limit (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>A positive integer indicating the maximum number of results to be returned, or END\_OF\_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server’s own limit, defined by the <a className="reference external" href="/content/config/#config-main-general">max\_get\_records\_size</a> parameter in the server configuration. Use output parameter <span className="em">has\_more\_records</span> to see if more records exist in the result to be fetched, and input parameter <span className="em">offset</span> and input parameter <span className="em">limit</span> to request subsequent pages of results. The default value is -9999.</p>
            </div>

            <div className="dt">encoding (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Specifies the encoding for returned records; one of <span className="em">binary</span>, <span className="em">json</span>, or <span className="em">geojson</span>. Allowed values are:</p>

              <ul className="simple">
                <li>
                  <p>binary</p>
                </li>

                <li>
                  <p>json</p>
                </li>

                <li>
                  <p>geojson</p>
                </li>

                <li>
                  <p>arrow</p>
                </li>
              </ul>

              <p>The default value is ‘binary’.</p>
            </div>

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

            <div className="dd">
              <p>Allowed keys are:</p>

              <ul>
                <li>
                  <p><strong>expression</strong> – Filter expression to apply to the table.</p>
                </li>

                <li>
                  <p><strong>fast\_index\_lookup</strong> – Indicates if indexes should be used to perform the lookup for a given expression if possible. Only applicable if there is no sorting, the expression contains only equivalence comparisons based on existing tables indexes and the range of requested values is from \[0 to END\_OF\_SET]. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘true’.</p>
                </li>

                <li>
                  <p><strong>sort\_by</strong> – Column that the data should be sorted by. Empty by default (i.e. no sorting is applied).</p>
                </li>

                <li>
                  <p><strong>sort\_order</strong> – String indicating how the returned values should be sorted - ascending or descending. If sort\_order is provided, sort\_by has to be provided. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>ascending</p>
                    </li>

                    <li>
                      <p>descending</p>
                    </li>
                  </ul>

                  <p>The default value is ‘ascending’.</p>
                </li>
              </ul>

              <p>The default value is an empty dict ( {"{"}{"}"} ).</p>
            </div>

            <div className="dt">get\_record\_type (<span className="em">bool</span>) –</div>

            <div className="dd">
              <p>If True, deduce and return the record type for the returned records. Default is True.</p>
            </div>
          </div>
        </div>
      </div>

      <p><strong>Returns</strong></p>

      <div className="blockquote">
        <div>
          <p>A dict with the following entries–</p>

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

            <div className="dd">
              <p>Value of input parameter <span className="em">table\_name</span>.</p>
            </div>

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

            <div className="dd">
              <p>The name of the type of the returned records.</p>
            </div>

            <div className="dt">type\_schema (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Avro schema of output parameter <span className="em">records\_binary</span> or output parameter <span className="em">records\_json</span>.</p>
            </div>

            <div className="dt">records\_binary (<span className="em">list of bytes</span>) –</div>

            <div className="dd">
              <p>If the input parameter <span className="em">encoding</span> was ‘binary’, then this list contains the binary encoded records retrieved from the table, otherwise not populated.</p>
            </div>

            <div className="dt">records\_json (<span className="em">list of str</span>) –</div>

            <div className="dd">
              <p>If the input parameter <span className="em">encoding</span> was ‘json’, then this list contains the JSON encoded records retrieved from the table. If the input parameter <span className="em">encoding</span> was ‘geojson’ this list contains a single entry consisting of a GeoJSON FeatureCollection containing a feature per record. Otherwise not populated.</p>
            </div>

            <div className="dt">total\_number\_of\_records (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>Total/Filtered number of records.</p>
            </div>

            <div className="dt">has\_more\_records (<span className="em">bool</span>) –</div>

            <div className="dd">
              <p>Too many records. Returned a partial set.</p>
            </div>

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

            <div className="dd">
              <p>Additional information.</p>
            </div>

            <div className="dt">record\_type (<code className="xref py py-class docutils literal notranslate"><span className="pre">RecordType</span></code> or None) –</div>

            <div className="dd">
              <p>A <code className="xref py py-class docutils literal notranslate"><span className="pre">RecordType</span></code> object using which the user can decode the binary data by using <a className="reference internal" href="/content/api/python/source/gpudbrecord#gpudb.GPUdbRecord.decode_binary_data" title="gpudb.GPUdbRecord.decode_binary_data"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdbRecord.decode\_binary\_data()</span></code></a>. Available only if get\_record\_type is True.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
