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

# GPUdb.Type

> GPUdb.Type — Kinetica API

<div className="kinetica-jsdoc">
  <h1 className="page-title">Class: Type</h1>

  <div className="section">
    <div className="header">
      <h2><span className="attribs"><span className="type-signature" /></span> <span className="ancestors"><a href="/content/api/javascript/GPUdb">GPUdb</a>.</span>Type<span className="signature">(label, …columns)</span><span className="type-signature" /></h2>
      <div className="class-description">Metadata about a GPUdb type.</div>
    </div>

    <div className="article">
      <div className="container-overview">
        <h2>Constructor</h2>
        <h4 className="name" id="Type"><span className="type-signature" />new Type<span className="signature">(label, …columns)</span><span className="type-signature" /></h4>
        <div className="description"> Creates a Type object containing metadata about a GPUdb type. </div>
        <h5>Parameters:</h5>

        <table className="params">
          <thead>
            <tr>
              <th>Name</th>
              <th>Type</th>
              <th>Attributes</th>
              <th className="last">Description</th>
            </tr>
          </thead>

          <tbody>
            <tr>
              <td className="name"><code>label</code></td>
              <td className="type"> <span className="param-type">String</span> </td>

              <td className="attributes" />

              <td className="description last">A user-defined description string which can be used to differentiate between data with otherwise identical schemas.</td>
            </tr>

            <tr>
              <td className="name"><code>columns</code></td>
              <td className="type"> <span className="param-type"><a href="/content/api/javascript/GPUdb.Type.Column">GPUdb.Type.Column</a></span> </td>
              <td className="attributes"> \<repeatable><br /> </td>
              <td className="description last">The list of columns that the type comprises.</td>
            </tr>
          </tbody>
        </table>

        <div className="dl details">
          <div className="dt tag-source">Source:</div>

          <div className="dd tag-source">
            <ul className="dummy">
              <li> , </li>
            </ul>
          </div>
        </div>
      </div>

      <h3 className="subsection-title">Classes</h3>

      <div className="dl">
        <div className="dt"><a href="/content/api/javascript/GPUdb.Type.Column">Column</a></div>

        <div className="dd" />
      </div>

      <h3 className="subsection-title">Members</h3>
      <h4 className="name" id="columns"><span className="type-signature" />columns<span className="type-signature"> :Array.\<<a href="/content/api/javascript/GPUdb.Type.Column">GPUdb.Type.Column</a>></span></h4>
      <div className="description"> The list of columns that the type comprises. </div>
      <h5>Type:</h5>

      <ul>
        <li> <span className="param-type">Array.\<<a href="/content/api/javascript/GPUdb.Type.Column">GPUdb.Type.Column</a>></span> </li>
      </ul>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h4 className="name" id="label"><span className="type-signature" />label<span className="type-signature"> :String</span></h4>
      <div className="description"> A user-defined description string which can be used to differentiate between data with otherwise identical schemas. </div>
      <h5>Type:</h5>

      <ul>
        <li> <span className="param-type">String</span> </li>
      </ul>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h3 className="subsection-title">Methods</h3>
      <h4 className="name" id="create"><span className="type-signature" />create<span className="signature">(gpudb, callback<span className="signature-attributes">opt</span>)</span><span className="type-signature"> → {"{"}String{"}"}</span></h4>

      <div className="description">
        Creates a new type in GPUdb based on the metadata in the Type object and returns the GPUdb type ID for use in subsequent operations.
        <p>If a callback function is provided, the type will be created asynchronously, and the result (either a type ID or an error) will be passed to the callback function upon completion.</p>
        <p>If a callback function is not provided, the type will be created synchronously and the type ID returned directly, and an exception will be thrown if an error occurs.</p>
      </div>

      <h5>Parameters:</h5>

      <table className="params">
        <thead>
          <tr>
            <th>Name</th>
            <th>Type</th>
            <th>Attributes</th>
            <th className="last">Description</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td className="name"><code>gpudb</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/GPUdb">GPUdb</a></span> </td>

            <td className="attributes" />

            <td className="description last">GPUdb API object.</td>
          </tr>

          <tr>
            <td className="name"><code>callback</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/global#GPUdbCallback">GPUdbCallback</a></span> </td>
            <td className="attributes"> \<optional><br /> </td>
            <td className="description last">The callback function, if asynchronous operation is desired.</td>
          </tr>
        </tbody>
      </table>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h5>Returns:</h5>
      <div className="param-desc"> The type ID, if no callback function is provided. </div>

      <div className="dl">
        <div className="dt"> Type </div>
        <div className="dd"> <span className="param-type">String</span> </div>
      </div>

      <h4 className="name" id="generate_schema"><span className="type-signature" />generate\_schema<span className="signature">()</span><span className="type-signature"> → {"{"}Object{"}"}</span></h4>
      <div className="description"> Generates an Avro record schema based on the metadata in the Type object. </div>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h5>Returns:</h5>
      <div className="param-desc"> The Avro record schema. </div>

      <div className="dl">
        <div className="dt"> Type </div>
        <div className="dd"> <span className="param-type">Object</span> </div>
      </div>

      <h4 className="name" id=".from_table"><span className="type-signature">(static) </span>from\_table<span className="signature">(gpudb, table\_name, callback<span className="signature-attributes">opt</span>)</span><span className="type-signature"> → {"{"}<a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a>{"}"}</span></h4>

      <div className="description">
        Creates a Type object containing metadata about the type stored in the specified table in GPUdb.
        <p>If a callback function is provided, the metadata will be obtained asynchronously, and the result (either a Type object or an error) will be passed to the callback function upon completion.</p>
        <p>If a callback function is not provided, the metadata will be obtained synchronously and the Type object returned directly, and an exception will be thrown if an error occurs.</p>
      </div>

      <h5>Parameters:</h5>

      <table className="params">
        <thead>
          <tr>
            <th>Name</th>
            <th>Type</th>
            <th>Attributes</th>
            <th className="last">Description</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td className="name"><code>gpudb</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/GPUdb">GPUdb</a></span> </td>

            <td className="attributes" />

            <td className="description last">GPUdb API object.</td>
          </tr>

          <tr>
            <td className="name"><code>table\_name</code></td>
            <td className="type"> <span className="param-type">String</span> </td>

            <td className="attributes" />

            <td className="description last">The table from which to obtain type metadata.</td>
          </tr>

          <tr>
            <td className="name"><code>callback</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/global#GPUdbCallback">GPUdbCallback</a></span> </td>
            <td className="attributes"> \<optional><br /> </td>
            <td className="description last">The callback function, if asynchronous operation is desired.</td>
          </tr>
        </tbody>
      </table>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h5>Returns:</h5>
      <div className="param-desc"> The Type object, if no callback function is provided. </div>

      <div className="dl">
        <div className="dt"> Type </div>
        <div className="dd"> <span className="param-type"><a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a></span> </div>
      </div>

      <h4 className="name" id=".from_type"><span className="type-signature">(static) </span>from\_type<span className="signature">(gpudb, type\_id, callback<span className="signature-attributes">opt</span>)</span><span className="type-signature"> → {"{"}<a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a>{"}"}</span></h4>

      <div className="description">
        Creates a Type object containing metadata about the specified type in GPUdb.
        <p>If a callback function is provided, the metadata will be obtained asynchronously, and the result (either a Type object or an error) will be passed to the callback function upon completion.</p>
        <p>If a callback function is not provided, the metadata will be obtained synchronously and the Type object returned directly, and an exception will be thrown if an error occurs.</p>
      </div>

      <h5>Parameters:</h5>

      <table className="params">
        <thead>
          <tr>
            <th>Name</th>
            <th>Type</th>
            <th>Attributes</th>
            <th className="last">Description</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td className="name"><code>gpudb</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/GPUdb">GPUdb</a></span> </td>

            <td className="attributes" />

            <td className="description last">GPUdb API object.</td>
          </tr>

          <tr>
            <td className="name"><code>type\_id</code></td>
            <td className="type"> <span className="param-type">String</span> </td>

            <td className="attributes" />

            <td className="description last">The type for which to obtain metadata.</td>
          </tr>

          <tr>
            <td className="name"><code>callback</code></td>
            <td className="type"> <span className="param-type"><a href="/content/api/javascript/global#GPUdbCallback">GPUdbCallback</a></span> </td>
            <td className="attributes"> \<optional><br /> </td>
            <td className="description last">The callback function, if asynchronous operation is desired.</td>
          </tr>
        </tbody>
      </table>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h5>Returns:</h5>
      <div className="param-desc"> The Type object, if no callback function is provided. </div>

      <div className="dl">
        <div className="dt"> Type </div>
        <div className="dd"> <span className="param-type"><a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a></span> </div>
      </div>

      <h4 className="name" id=".from_type_info"><span className="type-signature">(static) </span>from\_type\_info<span className="signature">(label, type\_schema, properties)</span><span className="type-signature"> → {"{"}<a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a>{"}"}</span></h4>
      <div className="description"> Creates a Type object using data returned from the GPUdb show\_table or show\_types endpoints. </div>
      <h5>Parameters:</h5>

      <table className="params">
        <thead>
          <tr>
            <th>Name</th>
            <th>Type</th>
            <th className="last">Description</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td className="name"><code>label</code></td>
            <td className="type"> <span className="param-type">String</span> </td>
            <td className="description last">A user-defined description string which can be used to differentiate between data with otherwise identical schemas.</td>
          </tr>

          <tr>
            <td className="name"><code>type\_schema</code></td>
            <td className="type"> <span className="param-type">String</span> | <span className="param-type">Object</span> </td>
            <td className="description last">The Avro record schema for the type.</td>
          </tr>

          <tr>
            <td className="name"><code>properties</code></td>
            <td className="type"> <span className="param-type">Object.\<String, Array.\<String>></span> </td>
            <td className="description last">A map of column names to lists of properties that apply to those columns.</td>
          </tr>
        </tbody>
      </table>

      <div className="dl details">
        <div className="dt tag-source">Source:</div>

        <div className="dd tag-source">
          <ul className="dummy">
            <li> , </li>
          </ul>
        </div>
      </div>

      <h5>Returns:</h5>
      <div className="param-desc"> The Type object. </div>

      <div className="dl">
        <div className="dt"> Type </div>
        <div className="dd"> <span className="param-type"><a href="/content/api/javascript/GPUdb.Type">GPUdb.Type</a></span> </div>
      </div>
    </div>
  </div>
</div>
