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

# restore_backup

<div className="kinetica-pydoc">
  <div className="dl py method">
    <div className="dt sig sig-object py" id="gpudb.GPUdb.restore_backup"> <span className="sig-name descname"><span className="pre">restore\_backup</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">backup\_name</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">restore\_objects\_map</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">datasource\_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">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#L37344"><span className="viewcode-link"><span className="pre">\[source]</span></span></a></div>

    <div className="dd">
      <p>Restores database objects from a <a className="reference external" href="/content/admin/backup_restore/#database-backup">backup</a> accessible via the <a className="reference external" href="/content/concepts/data_sources/">data source</a> specified by input parameter <span className="em">datasource\_name</span>.</p>
      <p><strong>Parameters</strong></p>

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

            <div className="dd">
              <p>Name of the backup to restore from, which must refer to an existing backup. The default value is ‘’.</p>
            </div>

            <div className="dt">restore\_objects\_map (<span className="em">dict of str to str</span>) –</div>

            <div className="dd">
              <p>Map of database objects to be restored from the backup. Allowed keys are:</p>

              <ul className="simple">
                <li>
                  <p><strong>all</strong> – All object types and data contained in the given <a className="reference external" href="/content/concepts/schemas/">schema(s)</a>.</p>
                </li>

                <li>
                  <p><strong>catalog</strong> – Data Lake catalog that is external to the database.</p>
                </li>

                <li>
                  <p><strong>context</strong> – <a className="reference external" href="/content/sql-gpt/concepts/#sql-gpt-context">Context(s)</a>.</p>
                </li>

                <li>
                  <p><strong>credential</strong> – <a className="reference external" href="/content/concepts/credentials/">Credential(s)</a>.</p>
                </li>

                <li>
                  <p><strong>datasink</strong> – <a className="reference external" href="/content/concepts/data_sinks/">Data sink(s)</a>.</p>
                </li>

                <li>
                  <p><strong>datasource</strong> – <a className="reference external" href="/content/concepts/data_sources/">Data source(s)</a>.</p>
                </li>

                <li>
                  <p><strong>directory</strong> – KiFS <a className="reference external" href="/content/tools/kifs/">File directory(ies)</a>.</p>
                </li>

                <li>
                  <p><strong>function\_environment</strong> – <a className="reference external" href="/content/udf/python/writing/#udf-python-func-env">Python UDF function environment(s)</a>.</p>
                </li>

                <li>
                  <p><strong>graph</strong> – <a className="reference external" href="/content/graph_solver/network_graph_solver/">Graph</a> definition(s). Source table(s), if applicable, are required in order to restore graph objects.</p>
                </li>

                <li>
                  <p><strong>monitor</strong> – <a className="reference external" href="/content/concepts/table_monitors/">Table monitor(s)</a> / <a className="reference external" href="/content/sql/ddl/create-stream">SQL stream(s)</a>.</p>
                </li>

                <li>
                  <p><strong>resource\_group</strong> – <a className="reference external" href="/content/rm/concepts/#resource-groups">Resource group(s)</a>.</p>
                </li>

                <li>
                  <p><strong>role</strong> – <a className="reference external" href="/content/security/sec_concepts/#roles">Role(s)</a>, role members (roles or users, recursively), and associated permissions.</p>
                </li>

                <li>
                  <p><strong>stored\_procedure</strong> – <a className="reference external" href="/content/sql/procedure/">SQL procedure(s)</a>.</p>
                </li>

                <li>
                  <p><strong>table</strong> – <a className="reference external" href="/content/concepts/tables/">Table(s)</a> and <a className="reference external" href="/content/sql/ddl/create-view">SQL view(s)</a>. Tables with subscriptions will by default be restored in the state they were in at the time of the snapshot. See <span className="em">restore\_subscriptions</span> for options to override the default behavior.</p>
                </li>

                <li>
                  <p><strong>user</strong> – <a className="reference external" href="/content/security/sec_concepts/#security-concepts-users">User(s)</a> (internal and external) and associated permissions.</p>
                </li>

                <li>
                  <p><strong>user\_defined\_function</strong> – <a className="reference external" href="/content/udf_overview">UDF(s)</a>.</p>
                </li>
              </ul>
            </div>

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

            <div className="dd">
              <p>Data source through which the backup will be restored.</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>backup\_id</strong> – ID of the snapshot to restore. Leave empty to restore the most recent snapshot in the backup. The default value is ‘’.</p>
                </li>

                <li>
                  <p><strong>checksum</strong> – Whether or not to verify checksums for backup files when restoring. 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\_schema\_if\_not\_exist</strong> – Behavior to apply when the schema containing any database object to restore does not already exist. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>true</strong> – If the schema containing any restored object does not exist, create it automatically.</p>
                    </li>

                    <li>
                      <p><strong>false</strong> – If the schema containing any restored object does not exist, return an error.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>ddl\_only</strong> – Behavior to apply when restoring tables. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>true</strong> – Restore table DDL, but do not restore data.</p>
                    </li>

                    <li>
                      <p><strong>false</strong> – Restore tables and their data.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>dry\_run</strong> – Whether or not to perform a dry run of the restoration operation. 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>restore\_subscriptions</strong> – Behavior to apply when restoring datasource subscriptions on tables. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>resume</strong> – Resume subscriptions that were active when the backup was made.</p>
                    </li>

                    <li>
                      <p><strong>pause</strong> – Pause subscriptions that were active when the backup was made.</p>
                    </li>

                    <li>
                      <p><strong>cancel</strong> – Cancel active subscriptions.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>reingest</strong> – Behavior to apply when restoring table data. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>true</strong> – Restore table data by re-ingesting it. This is the default behavior if the cluster topology differs from that of the contained backup.</p>
                    </li>

                    <li>
                      <p><strong>false</strong> – Restore the persisted data files directly.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>renamed\_objects\_schema</strong> – If the <span className="em">restore\_policy</span> is <span className="em">rename</span>, use this schema for relocated existing objects instead of the default generated one. The default value is ‘’.</p>
                </li>

                <li>
                  <p><strong>restore\_all\_permissions</strong> – Whether or not all permissions of restored principals should be restored or scoped to the restored objects. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>true</strong> – Restore all permissions.</p>
                    </li>

                    <li>
                      <p><strong>false</strong> – Restore only permissions on restored objects.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>restore\_policy</strong> – Behavior to apply when any database object to restore already exists. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p><strong>none</strong> – If an object to be restored already exists with the same name, abort and return error.</p>
                    </li>

                    <li>
                      <p><strong>replace</strong> – If an object to be restored already exists with the same name, replace it with the backup version.</p>
                    </li>

                    <li>
                      <p><strong>rename</strong> – If an object to be restored already exists with the same name, move that existing one to the schema specified by <span className="em">renamed\_objects\_schema</span>. This policy does not apply to non-schema objects.</p>
                    </li>
                  </ul>

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

                <li>
                  <p><strong>target\_schema\_map</strong> – Restore schema-based objects to alternate schema. Value is a comma delimitted list of key:value pairs mapping the original (source) schema name as it exists in the backup to a target (destination) schema namespace: “src: dst \[, src: dst \[, …]]”. Note that schema names are case sensitive and must adhere to the database schema <a className="reference external" href="/content/concepts/schemas/">naming criteria</a>. The default value is ‘’.</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 simple">
            <div className="dt">backup\_name (<span className="em">str</span>) –</div>

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

            <div className="dt">backup\_id (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>ID of the snapshot that was restored.</p>
            </div>

            <div className="dt">restored\_bytes (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>Total size of data restored from backup.</p>
            </div>

            <div className="dt">restored\_files (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>Total number of files restored from backup.</p>
            </div>

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

            <div className="dd">
              <p>Total number of records restored from backup.</p>
            </div>

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

            <div className="dd">
              <p>Database objects that were successfully restored and their associated types.</p>
            </div>

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

            <div className="dd">
              <p>Original and new names of database objects that were successfully restored and their associated types.</p>
            </div>

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

            <div className="dd">
              <p>Database objects that failed to be restored and their associated types.</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>
        </div>
      </div>
    </div>
  </div>
</div>
