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

# insert_records_from_files

<div className="kinetica-typedoc">
  <div className="section tsd-panel tsd-member">
    <h3 className="tsd-anchor-link" id="insert_records_from_files"><span>insert\_records\_from\_files</span></h3>

    <ul className="tsd-signatures">
      <li className="">
        <div className="tsd-signature tsd-anchor-link" id="insert_records_from_files-1"><span className="tsd-kind-call-signature">insert\_records\_from\_files</span><span className="tsd-signature-symbol">(</span><br /> <span className="tsd-kind-parameter">table\_name</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">filepaths</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">\[]</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">modify\_columns</span><span className="tsd-signature-symbol">?:</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">create\_table\_options</span><span className="tsd-signature-symbol">?:</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">options</span><span className="tsd-signature-symbol">?:</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">callback</span><span className="tsd-signature-symbol">?:</span> <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a><span className="tsd-signature-symbol">,</span><br /><span className="tsd-signature-symbol">)</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/InsertRecordsFromFilesResponse" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesResponse</a><span className="tsd-signature-symbol">></span></div>

        <div className="tsd-description">
          <div className="tsd-comment tsd-typography">
            <p>Reads from one or more files and inserts the data into a new or existing table. The source data can be located either in KiFS; on the cluster, accessible to the database; or remotely, accessible via a pre-defined external data source.</p>
            <p>For delimited text files, there are two loading schemes: positional and name-based. The name-based loading scheme is enabled when the file has a header present and text\_has\_header is set to true. In this scheme, the source file(s) field names must match the target table's column names exactly; however, the source file can have more fields than the target table has columns. If error\_handling is set to permissive, the source file can have fewer fields than the target table has columns. If the name-based loading scheme is being used, names matching the file header's names may be provided to columns\_to\_load instead of numbers, but ranges are not supported.</p>
            <p>Note: Due to data being loaded in parallel, there is no insertion order guaranteed. For tables with primary keys, in the case of a primary key collision, this means it is indeterminate which record will be inserted first and remain, while the rest of the colliding key records are discarded.</p>
            <p>Returns once all files are processed.</p>
          </div>

          <div className="tsd-parameters">
            <h4 className="tsd-parameters-title">Parameters</h4>

            <ul className="tsd-parameter-list">
              <li>
                <span><span className="tsd-kind-parameter">table\_name</span>: <span className="tsd-signature-type">string</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Name of the table into which the data will be inserted, in \[schema\_name.]table\_name format, using standard name resolution rules. If the table does not exist, the table will be created using either an existing type\_id or the type inferred from the file, and the new table name will have to meet standard table naming criteria.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">filepaths</span>: <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">\[]</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>A list of file paths from which data will be sourced;</p>
                  <p>For paths in KiFS, use the URI prefix of kifs\:// followed by the path to a file or directory. File matching by prefix is supported, e.g. kifs\://dir/file would match dir/file\_1 and dir/file\_2. When prefix matching is used, the path must start with a full, valid KiFS directory name.</p>
                  <p>If an external data source is specified in datasource\_name, these file paths must resolve to accessible files at that data source location. Prefix matching is supported. If the data source is hdfs, prefixes must be aligned with directories, i.e. partial file names will not match.</p>
                  <p>If no data source is specified, the files are assumed to be local to the database and must all be accessible to the gpudb user, residing on the path (or relative to the path) specified by the external files directory in the Kinetica configuration file. Wildcards (\*) can be used to specify a group of files. Prefix matching is supported, the prefixes must be aligned with directories.</p>
                  <p>If the first path ends in .tsv, the text delimiter will be defaulted to a tab character. If the first path ends in .psv, the text delimiter will be defaulted to a pipe character (|).</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">modify\_columns</span>: <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">></span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Not implemented yet.</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">create\_table\_options</span>: <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Options from <code>create\_table</code>, allowing the structure of the table to be defined independently of the data source, when creating the target table</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">options</span>: <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional parameters.</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">callback</span>: <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional callback function</p>
                </div>
              </li>
            </ul>
          </div>

          <h4 className="tsd-returns-title">Returns <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/InsertRecordsFromFilesResponse" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesResponse</a><span className="tsd-signature-symbol">></span></h4>
          <p>Promise\<Types.InsertRecordsFromFilesResponse> - Promise resolving to the response</p>

          <div className="aside tsd-sources">
            <ul>
              <li>Defined in <a href="https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L11475">src/GPUdb.ts:11475</a></li>
            </ul>
          </div>
        </div>
      </li>
    </ul>
  </div>

  <div className="section tsd-panel tsd-member">
    <h3 className="tsd-anchor-link" id="insert_records_from_files_request"><span>insert\_records\_from\_files\_request</span></h3>

    <ul className="tsd-signatures">
      <li className="">
        <div className="tsd-signature tsd-anchor-link" id="insert_records_from_files_request-1"><span className="tsd-kind-call-signature">insert\_records\_from\_files\_request</span><span className="tsd-signature-symbol">(</span><br /> <span className="tsd-kind-parameter">request</span><span className="tsd-signature-symbol">:</span> <a href="/content/api/javascript/interfaces/InsertRecordsFromFilesRequest" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesRequest</a><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">callback</span><span className="tsd-signature-symbol">?:</span> <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a><span className="tsd-signature-symbol">,</span><br /><span className="tsd-signature-symbol">)</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/InsertRecordsFromFilesResponse" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesResponse</a><span className="tsd-signature-symbol">></span></div>

        <div className="tsd-description">
          <div className="tsd-comment tsd-typography">
            <p>Reads from one or more files and inserts the data into a new or existing table. The source data can be located either in KiFS; on the cluster, accessible to the database; or remotely, accessible via a pre-defined external data source.</p>
            <p>For delimited text files, there are two loading schemes: positional and name-based. The name-based loading scheme is enabled when the file has a header present and text\_has\_header is set to true. In this scheme, the source file(s) field names must match the target table's column names exactly; however, the source file can have more fields than the target table has columns. If error\_handling is set to permissive, the source file can have fewer fields than the target table has columns. If the name-based loading scheme is being used, names matching the file header's names may be provided to columns\_to\_load instead of numbers, but ranges are not supported.</p>
            <p>Note: Due to data being loaded in parallel, there is no insertion order guaranteed. For tables with primary keys, in the case of a primary key collision, this means it is indeterminate which record will be inserted first and remain, while the rest of the colliding key records are discarded.</p>
            <p>Returns once all files are processed.</p>
          </div>

          <div className="tsd-parameters">
            <h4 className="tsd-parameters-title">Parameters</h4>

            <ul className="tsd-parameter-list">
              <li>
                <span><span className="tsd-kind-parameter">request</span>: <a href="/content/api/javascript/interfaces/InsertRecordsFromFilesRequest" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesRequest</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Request object containing the parameters for the operation</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">callback</span>: <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional callback function</p>
                </div>
              </li>
            </ul>
          </div>

          <h4 className="tsd-returns-title">Returns <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/InsertRecordsFromFilesResponse" className="tsd-signature-type tsd-kind-interface">InsertRecordsFromFilesResponse</a><span className="tsd-signature-symbol">></span></h4>
          <p>Promise\<Types.InsertRecordsFromFilesResponse> - Promise resolving to the response</p>

          <div className="aside tsd-sources">
            <ul>
              <li>Defined in <a href="https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L11396">src/GPUdb.ts:11396</a></li>
            </ul>
          </div>
        </div>
      </li>
    </ul>
  </div>
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.