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

# create_table

<div className="kinetica-pydoc">
  <div className="dl py method">
    <div className="dt sig sig-object py" id="gpudb.GPUdb.create_table"> <span className="sig-name descname"><span className="pre">create\_table</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">type\_id</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">options</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">{"{"}{"}"}</span></span></span><span className="sig-paren">)</span><a href="https://github.com/kineticadb/kinetica-api-python/blob/master/gpudb/gpudb.py#L23886"><span className="viewcode-link"><span className="pre">\[source]</span></span></a></div>

    <div className="dd">
      <p>Creates a new table with the given type (definition of columns). The type is specified in input parameter <span className="em">type\_id</span> as either a numerical type ID (as returned by <a className="reference internal" href="#gpudb.GPUdb.create_type" title="gpudb.GPUdb.create_type"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_type()</span></code></a>) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.</p>
      <p>Example of a type definition with some parameters:</p>

      <div className="highlight-default notranslate">
        <div>
          ```
          [
              ["id", "int8", "primary_key"],
              ["dept_id", "int8", "primary_key", "shard_key"],
              ["manager_id", "int8", "nullable"],
              ["first_name", "char32"],
              ["last_name", "char64"],
              ["salary", "decimal"],
              ["hire_date", "date"]
          ]
          ```
        </div>
      </div>

      <p>Each column definition consists of the column name (which should meet the standard <a className="reference external" href="/content/concepts/tables/#table-naming-criteria">column naming criteria</a>), the column’s <a className="reference external" href="/content/concepts/types/#types-chart">specific type</a> (int, long, float, double, string, bytes, or any of the properties map values from <a className="reference internal" href="#gpudb.GPUdb.create_type" title="gpudb.GPUdb.create_type"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_type()</span></code></a>), and any <a className="reference external" href="/content/concepts/types/#types-data-handling">data handling</a>, <a className="reference external" href="/content/concepts/types/#types-data-keys">data key</a>, or <a className="reference external" href="/content/concepts/types/#types-data-replace">data replacement</a> properties.</p>
      <p>A table may optionally be designated to use a <a className="reference external" href="/content/concepts/tables/#replication">replicated</a> distribution scheme, or be assigned: <a className="reference external" href="/content/concepts/tables/#foreign-keys">foreign keys</a> to other tables, a <a className="reference external" href="/content/concepts/tables/#partitioning">partitioning</a> scheme, and/or a <a className="reference external" href="/content/rm/concepts/#tier-strategies">tier strategy</a>.</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 to be created, in \[schema\_name.]table\_name format, using standard <a className="reference external" href="/content/concepts/tables/#table-name-resolution">name resolution rules</a> and meeting <a className="reference external" href="/content/concepts/tables/#table-naming-criteria">table naming criteria</a>. Error for requests with existing table of the same name and type ID may be suppressed by using the <span className="em">no\_error\_if\_exists</span> option.</p>
            </div>

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

            <div className="dd">
              <p>The type for the table, specified as either an existing table’s numerical type ID (as returned by <a className="reference internal" href="#gpudb.GPUdb.create_type" title="gpudb.GPUdb.create_type"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_type()</span></code></a>) or a type definition (as described above).</p>
            </div>

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

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

              <ul>
                <li>
                  <p><strong>no\_error\_if\_exists</strong> – If <span className="em">true</span>, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>create\_temp\_table</strong> – If <span className="em">true</span>, a unique temporary table name will be generated in the sys\_temp schema and used in place of input parameter <span className="em">table\_name</span>. If <span className="em">is\_result\_table</span> is <span className="em">true</span>, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in <span className="em">qualified\_table\_name</span>. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>collection\_name</strong> – \[DEPRECATED–please specify the containing schema as part of input parameter <span className="em">table\_name</span> and use <a className="reference internal" href="#gpudb.GPUdb.create_schema" title="gpudb.GPUdb.create_schema"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_schema()</span></code></a> to create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created.</p>
                </li>

                <li>
                  <p><strong>is\_collection</strong> – \[DEPRECATED–please use <a className="reference internal" href="#gpudb.GPUdb.create_schema" title="gpudb.GPUdb.create_schema"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_schema()</span></code></a> to create a schema instead] Indicates whether to create a schema instead of a table. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>is\_replicated</strong> – Affects the <a className="reference external" href="/content/concepts/tables/#distribution">distribution scheme</a> for the table’s data. If <span className="em">true</span> and the given type has no explicit <a className="reference external" href="/content/concepts/tables/#shard-key">shard key</a> defined, the table will be <a className="reference external" href="/content/concepts/tables/#replication">replicated</a>. If <span className="em">false</span>, the table will be <a className="reference external" href="/content/concepts/tables/#sharding">sharded</a> according to the shard key specified in the given input parameter <span className="em">type\_id</span>, or <a className="reference external" href="/content/concepts/tables/#random-sharding">randomly sharded</a>, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>foreign\_keys</strong> – Semicolon-separated list of <a className="reference external" href="/content/concepts/tables/#foreign-keys">foreign keys</a>, of the format ‘(source\_column\_name \[, …]) references target\_table\_name(primary\_key\_column\_name \[, …]) \[as foreign\_key\_name]’.</p>
                </li>

                <li>
                  <p><strong>foreign\_shard\_key</strong> – Foreign shard key of the format ‘source\_column references shard\_by\_column from target\_table(primary\_key\_column)’.</p>
                </li>

                <li>
                  <p><strong>partition\_type</strong> – <a className="reference external" href="/content/concepts/tables/#partitioning">Partitioning</a> scheme to use. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>RANGE</strong> – Use <a className="reference external" href="/content/concepts/tables/#partitioning-by-range">range partitioning</a>.</p>
                    </li>

                    <li>
                      <p><strong>INTERVAL</strong> – Use <a className="reference external" href="/content/concepts/tables/#partitioning-by-interval">interval partitioning</a>.</p>
                    </li>

                    <li>
                      <p><strong>LIST</strong> – Use <a className="reference external" href="/content/concepts/tables/#partitioning-by-list">list partitioning</a>.</p>
                    </li>

                    <li>
                      <p><strong>HASH</strong> – Use <a className="reference external" href="/content/concepts/tables/#partitioning-by-hash">hash partitioning</a>.</p>
                    </li>

                    <li>
                      <p><strong>SERIES</strong> – Use <a className="reference external" href="/content/concepts/tables/#partitioning-by-series">series partitioning</a>.</p>
                    </li>
                  </ul>
                </li>

                <li>
                  <p><strong>partition\_keys</strong> – Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined by <span className="em">partition\_definitions</span>.</p>
                </li>

                <li>
                  <p><strong>partition\_definitions</strong> – Comma-separated list of partition definitions, whose format depends on the choice of <span className="em">partition\_type</span>. See <a className="reference external" href="/content/concepts/tables/#partitioning-by-range">range partitioning</a>, <a className="reference external" href="/content/concepts/tables/#partitioning-by-interval">interval partitioning</a>, <a className="reference external" href="/content/concepts/tables/#partitioning-by-list">list partitioning</a>, <a className="reference external" href="/content/concepts/tables/#partitioning-by-hash">hash partitioning</a>, or <a className="reference external" href="/content/concepts/tables/#partitioning-by-series">series partitioning</a> for example formats.</p>
                </li>

                <li>
                  <p><strong>is\_automatic\_partition</strong> – If <span className="em">true</span>, a new partition will be created for values which don’t fall into an existing partition. Currently only supported for <a className="reference external" href="/content/concepts/tables/#partitioning-by-list">list partitions</a>. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>ttl</strong> – Sets the <a className="reference external" href="/content/concepts/ttl/">TTL</a> of the table specified in input parameter <span className="em">table\_name</span>.</p>
                </li>

                <li>
                  <p><strong>chunk\_size</strong> – Indicates the number of records per chunk to be used for this table.</p>
                </li>

                <li>
                  <p><strong>chunk\_column\_max\_memory</strong> – Indicates the target maximum data size for each column in a chunk to be used for this table.</p>
                </li>

                <li>
                  <p><strong>chunk\_max\_memory</strong> – Indicates the target maximum data size for all columns in a chunk to be used for this table.</p>
                </li>

                <li>
                  <p><strong>is\_result\_table</strong> – Indicates whether the table is a <a className="reference external" href="/content/concepts/tables_memory_only/">memory-only table</a>. A result table cannot contain columns with text\_search <a className="reference external" href="/content/concepts/types/#data-handling">data-handling</a>, and it will not be retained if the server is restarted. Allowed values are:</p>

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

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

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

                <li>
                  <p><strong>strategy\_definition</strong> – The <a className="reference external" href="/content/rm/concepts/#tier-strategies">tier strategy</a> for the table and its columns.</p>
                </li>

                <li>
                  <p><strong>compression\_codec</strong> – The default <a className="reference external" href="/content/concepts/column_compression/">compression codec</a> for this table’s columns.</p>
                </li>

                <li>
                  <p><strong>load\_vectors\_policy</strong> – Set startup data loading scheme for the table. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>always</strong> – Load as much vector data as possible into memory before accepting requests.</p>
                    </li>

                    <li>
                      <p><strong>lazy</strong> – Load the necessary vector data at start, and load the remainder lazily.</p>
                    </li>

                    <li>
                      <p><strong>on\_demand</strong> – Load vector data as requests use it.</p>
                    </li>

                    <li>
                      <p><strong>system</strong> – Load vector data using the system-configured default.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>build\_pk\_index\_policy</strong> – Set startup primary-key index generation scheme for the table. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>always</strong> – Generate as much primary key index data as possible before accepting requests.</p>
                    </li>

                    <li>
                      <p><strong>lazy</strong> – Generate the necessary primary key index data at start, and load the remainder lazily.</p>
                    </li>

                    <li>
                      <p><strong>on\_demand</strong> – Generate primary key index data as requests use it.</p>
                    </li>

                    <li>
                      <p><strong>system</strong> – Generate primary key index data using the system-configured default.</p>
                    </li>
                  </ul>

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

              <p>The default value is an empty dict ( {"{"}{"}"} ).</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">
            <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\_id (<span className="em">str</span>) –</div>

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

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

            <div className="dd">
              <p>\[DEPRECATED–this will always return false] Indicates if the created entity is a schema.</p>
            </div>

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

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

              <ul className="simple">
                <li>
                  <p><strong>qualified\_table\_name</strong> – The fully qualified name of the new table (i.e. including the schema).</p>
                </li>
              </ul>

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