<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Renaming the database Name in Databricks in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/75376#M7566</link>
    <description>&lt;P&gt;You can also use “CASCADE” to drop schema and tables as well. It is recursive.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jun 2024 00:26:32 GMT</pubDate>
    <dc:creator>Avvar2022</dc:creator>
    <dc:date>2024-06-22T00:26:32Z</dc:date>
    <item>
      <title>Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59477#M7559</link>
      <description>&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;Initially our team created the databases with the environment name appended. Ex: cust_dev, cust_qa, cust_prod.&lt;/P&gt;&lt;P&gt;I am looking to standardize the database name as consistent name across environments. I want to rename to "cust".&amp;nbsp;&lt;/P&gt;&lt;P&gt;All of my tables are external tables in this database pointing to a storage in ADLS.&amp;nbsp; which option will help?&lt;/P&gt;&lt;P&gt;1. Does databricks supports rename command ?&lt;/P&gt;&lt;P&gt;2. Create a new database CUST and recreate all the tables in new database . Steps to be followed&lt;/P&gt;&lt;P&gt;&amp;nbsp;a. create database cust&lt;/P&gt;&lt;P&gt;b. drop table &amp;lt;table1&amp;gt; from cust_dev&lt;/P&gt;&lt;P&gt;c. create table cust.&amp;lt;table1&amp;gt;&lt;/P&gt;&lt;P&gt;What is recommended option?&lt;/P&gt;&lt;P&gt;#deltatable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 15:27:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59477#M7559</guid>
      <dc:creator>Ramakrishnan83</dc:creator>
      <dc:date>2024-02-06T15:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59485#M7560</link>
      <description>&lt;P&gt;In Databricks, you cannot directly rename a schema using a specific SQL statement like ALTER SCHEMA or RENAME SCHEMA. However, you can achieve a similar result by following these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a new schema with the desired name using the CREATE SCHEMA statement.&lt;/LI&gt;&lt;LI&gt;Transfer all the &lt;SPAN&gt;(tables, views, functions, etc.)&lt;/SPAN&gt; from the old schema to the new schema using ALTER TABLE, ALTER VIEW, or other appropriate statements.&amp;nbsp;&lt;BR /&gt;&lt;EM&gt;ALTER TABLE old_schema.table_name SET SCHEMA new_schema;&lt;BR /&gt;ALTER VIEW old_schema.view_name SET SCHEMA new_schema;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Update any references to the old schema in your code or queries to use the new schema name.&lt;/LI&gt;&lt;LI&gt;Finally, if you no longer need the old schema, you can drop it using the DROP SCHEMA statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 06 Feb 2024 15:59:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59485#M7560</guid>
      <dc:creator>Hkesharwani</dc:creator>
      <dc:date>2024-02-06T15:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59538#M7561</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I don't see SET Schema as keyword in Alter table statement.&amp;nbsp;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html" target="_self"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your statement.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;alter&lt;/SPAN&gt; &lt;SPAN&gt;table&lt;/SPAN&gt; &lt;SPAN&gt;****&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;table_row_count&lt;/SPAN&gt; &lt;SPAN&gt;SET&lt;/SPAN&gt; &lt;SPAN&gt;SCHEMA&lt;/SPAN&gt; &lt;SPAN&gt;****&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;table_row_count&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;ParseException&lt;/SPAN&gt;: no viable alternative at input 'alter table****.table_row_count SET SCHEMA'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Feb 2024 03:45:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59538#M7561</guid>
      <dc:creator>Ramakrishnan83</dc:creator>
      <dc:date>2024-02-07T03:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59549#M7562</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;Apologies, I just tried the above statement and they were not working. You may try creating the table with CTAS statements.&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;create table&amp;nbsp;new_schema.table_name&amp;nbsp;as select * from&amp;nbsp;old_schema.table_name&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Feb 2024 06:28:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/59549#M7562</guid>
      <dc:creator>Hkesharwani</dc:creator>
      <dc:date>2024-02-07T06:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/66866#M7564</link>
      <description>&lt;P&gt;It does not work if you need to keep partitioning or table properties.&lt;/P&gt;&lt;P&gt;Solutions:&lt;/P&gt;&lt;P&gt;1. CREATE TABLE .. LIKE ..&lt;BR /&gt;2. CREATE TABLE ... CLONE&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Apr 2024 07:25:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/66866#M7564</guid>
      <dc:creator>roman_tkachuk</dc:creator>
      <dc:date>2024-04-21T07:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/75374#M7565</link>
      <description>&lt;P&gt;Since you can't simply rename the schema, here are the steps you need to follow in order to "Rename a Schema".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create new Schema.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE SCHEMA `catalog`.`new_schema_name`;​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For every object in the schema create a copy in the new schema.&amp;nbsp; Sample CTAS for a table move shown below, but you will also need to do this with other objects in the schema (functions, views, models, etc.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TABLE `catalog`.`new_schema_name`.`table_name` 
AS 
SELECT * 
FROM `catalog`.`old_schema_name`.`table_name`;​&lt;/LI-CODE&gt;&lt;P&gt;Drop the old objects in the old schema.&amp;nbsp;Sample drop for tables shown below, but you will also need to do this&lt;BR /&gt;with other objects in the schema (functions, views, models, etc.).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DROP TABLE `catalog`.`old_schema_name`.`table_name`;​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you've dropped all objects and have a blank schema, drop the schema.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DROP SCHEMA `catalog`.`old_schema_name`;​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 22:16:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/75374#M7565</guid>
      <dc:creator>bearded_data</dc:creator>
      <dc:date>2024-06-21T22:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming the database Name in Databricks</title>
      <link>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/75376#M7566</link>
      <description>&lt;P&gt;You can also use “CASCADE” to drop schema and tables as well. It is recursive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jun 2024 00:26:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/renaming-the-database-name-in-databricks/m-p/75376#M7566</guid>
      <dc:creator>Avvar2022</dc:creator>
      <dc:date>2024-06-22T00:26:32Z</dc:date>
    </item>
  </channel>
</rss>

