{"id":5816,"date":"2026-10-05T00:55:37","date_gmt":"2026-10-05T00:55:37","guid":{"rendered":"https:\/\/ranaghazzi.com\/?p=5816"},"modified":"2026-10-05T00:55:38","modified_gmt":"2026-10-05T00:55:38","slug":"table-cloning-in-databricks-deep-clone-vs-shallow-clone","status":"publish","type":"post","link":"https:\/\/ranaghazzi.com\/?p=5816","title":{"rendered":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone"},"content":{"rendered":"<p><style>\n    .light-font-container, .light-font-container p, .light-font-container h2, .light-font-container li {<br \/>\n        font-weight: #FFFFFF !important;<br \/>\n    }<br \/>\n<\/style>\n<\/p>\n<div class=\"light-font-container\" style=\"background-color: #FFFFFF ; padding: 40px; border-radius: 15px;\">\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Table Cloning in Databricks: Deep Clone vs. Shallow Clone<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;ve worked with Delta Lake tables in Databricks, you&#8217;ve probably needed a copy of a table at some point \u2014 for testing, backups, or migrating data. Databricks makes this easy with the CLONE command, which comes in two flavors: deep clone and shallow clone. Understanding the difference can save you time, storage costs, and headaches.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Deep Clone: The Full Copy<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A deep clone creates a complete, independent copy of a table \u2014 both its metadata and its underlying data files. Once the clone finishes, it has no dependency on the source table whatsoever.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-medium-font-size\">CREATE TABLE target_table\nDEEP CLONE source_table;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the right choice when you need durability and independence: backing up a table before a risky operation, archiving data long-term, or migrating a table to another workspace or region.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> The tradeoff is cost \u2014 copying every data file takes time and doubles your storage footprint. The good news is that deep clones are incremental: re-running the same clone command later only copies files that changed since the last clone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shallow Clone: The Fast, Lightweight Copy<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A shallow clone copies only the table&#8217;s metadata and transaction log \u2014 not the actual data files. The new table simply points back at the source&#8217;s existing Parquet files.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-medium-font-size\">CREATE TABLE target_table\nSHALLOW CLONE source_table;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This makes shallow clones nearly instantaneous and essentially free in storage terms. They&#8217;re perfect for short-lived use cases: spinning up a dev or test environment from production data, experimenting with a schema change, or reproducing a bug without touching the real table. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The catch is that a shallow clone isn&#8217;t fully independent \u2014 if the source table&#8217;s underlying files get deleted or vacuumed, the clone can break.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Time Travel and Clones<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Both clone types support Delta Lake&#8217;s time travel, so you can clone a table as it existed at a specific version or timestamp:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-medium-font-size\">CREATE TABLE target_table\nDEEP CLONE source_table VERSION AS OF 12;\n\nCREATE TABLE target_table\nSHALLOW CLONE source_table TIMESTAMP AS OF '2026-09-01';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is especially useful for debugging \u2014 you can recreate the exact state of a table at the moment an issue occurred.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Choosing the Right Clone<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Scenario<\/th><th>Recommended Clone<\/th><\/tr><\/thead><tbody><tr><td>Spinning up a test\/dev sandbox<\/td><td>Shallow<\/td><\/tr><tr><td>Backing up before a risky change<\/td><td>Deep<\/td><\/tr><tr><td>Migrating across workspaces\/regions<\/td><td>Deep<\/td><\/tr><tr><td>Reproducing a bug at a known version<\/td><td>Shallow<\/td><\/tr><tr><td>Long-term archival<\/td><td>Deep<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A Few Gotchas<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Shallow clones don&#8217;t automatically carry over CDC metadata (like <code>_change_data<\/code>).<\/li>\n\n\n\n<li>Permissions and grants on the source table are not inherited by the clone \u2014 you need to set them explicitly on the target.<\/li>\n\n\n\n<li>CREATE OR REPLACE TABLE &#8230; CLONE &#8230; lets you refresh an existing clone instead of recreating it from scratch.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Cloning is a small feature, but it&#8217;s one of those tools that quietly makes working with large-scale data pipelines much safer and faster. Whether you need a quick sandbox or a durable backup, Databricks gives you the right tool for the job.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Table Cloning in Databricks: Deep Clone vs. Shallow Clone If you&#8217;ve worked with Delta Lake tables in Databricks, you&#8217;ve probably needed a copy of a table at some point \u2014 for testing, backups, or migrating data. Databricks makes this easy with the CLONE command, which comes in two flavors: deep clone and shallow clone. Understanding [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5816","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi<\/title>\n<meta name=\"description\" content=\"Explore Rana Ghazzi&#039;s data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI &amp; Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ranaghazzi.com\/?p=5816\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi\" \/>\n<meta property=\"og:description\" content=\"Explore Rana Ghazzi&#039;s data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI &amp; Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ranaghazzi.com\/?p=5816\" \/>\n<meta property=\"og:site_name\" content=\"Rana Nasri Ghazzi\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-05T00:55:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-05T00:55:38+00:00\" \/>\n<meta name=\"author\" content=\"Rana Ghazzi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rana Ghazzi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816\"},\"author\":{\"name\":\"Rana Ghazzi\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#\\\/schema\\\/person\\\/d8ee34f53cb0df9faaf816fb5363a4cc\"},\"headline\":\"Table Cloning in Databricks: Deep Clone vs. Shallow Clone\",\"datePublished\":\"2026-10-05T00:55:37+00:00\",\"dateModified\":\"2026-10-05T00:55:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816\"},\"wordCount\":468,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#\\\/schema\\\/person\\\/d8ee34f53cb0df9faaf816fb5363a4cc\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816\",\"url\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816\",\"name\":\"Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#website\"},\"datePublished\":\"2026-10-05T00:55:37+00:00\",\"dateModified\":\"2026-10-05T00:55:38+00:00\",\"description\":\"Explore Rana Ghazzi's data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI & Python.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/?p=5816#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ranaghazzi.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Table Cloning in Databricks: Deep Clone vs. Shallow Clone\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#website\",\"url\":\"https:\\\/\\\/ranaghazzi.com\\\/\",\"name\":\"Rana Nasri Ghazzi\",\"description\":\"Turning Data into Decisions\",\"publisher\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#\\\/schema\\\/person\\\/d8ee34f53cb0df9faaf816fb5363a4cc\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ranaghazzi.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/#\\\/schema\\\/person\\\/d8ee34f53cb0df9faaf816fb5363a4cc\",\"name\":\"Rana Ghazzi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/logo.png\",\"url\":\"https:\\\/\\\/ranaghazzi.com\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/ranaghazzi.com\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/logo.png\",\"width\":1024,\"height\":1024,\"caption\":\"Rana Ghazzi\"},\"logo\":{\"@id\":\"https:\\\/\\\/ranaghazzi.com\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/logo.png\"},\"url\":\"https:\\\/\\\/ranaghazzi.com\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi","description":"Explore Rana Ghazzi's data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI & Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ranaghazzi.com\/?p=5816","og_locale":"en_US","og_type":"article","og_title":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi","og_description":"Explore Rana Ghazzi's data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI & Python.","og_url":"https:\/\/ranaghazzi.com\/?p=5816","og_site_name":"Rana Nasri Ghazzi","article_published_time":"2026-10-05T00:55:37+00:00","article_modified_time":"2026-10-05T00:55:38+00:00","author":"Rana Ghazzi","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rana Ghazzi","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ranaghazzi.com\/?p=5816#article","isPartOf":{"@id":"https:\/\/ranaghazzi.com\/?p=5816"},"author":{"name":"Rana Ghazzi","@id":"https:\/\/ranaghazzi.com\/#\/schema\/person\/d8ee34f53cb0df9faaf816fb5363a4cc"},"headline":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone","datePublished":"2026-10-05T00:55:37+00:00","dateModified":"2026-10-05T00:55:38+00:00","mainEntityOfPage":{"@id":"https:\/\/ranaghazzi.com\/?p=5816"},"wordCount":468,"commentCount":0,"publisher":{"@id":"https:\/\/ranaghazzi.com\/#\/schema\/person\/d8ee34f53cb0df9faaf816fb5363a4cc"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ranaghazzi.com\/?p=5816#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ranaghazzi.com\/?p=5816","url":"https:\/\/ranaghazzi.com\/?p=5816","name":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone - Rana Nasri Ghazzi","isPartOf":{"@id":"https:\/\/ranaghazzi.com\/#website"},"datePublished":"2026-10-05T00:55:37+00:00","dateModified":"2026-10-05T00:55:38+00:00","description":"Explore Rana Ghazzi's data analytics portfolio \u2014 dashboards, visualizations, and insights built with Tableau, Power BI & Python.","breadcrumb":{"@id":"https:\/\/ranaghazzi.com\/?p=5816#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ranaghazzi.com\/?p=5816"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ranaghazzi.com\/?p=5816#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ranaghazzi.com\/"},{"@type":"ListItem","position":2,"name":"Table Cloning in Databricks: Deep Clone vs. Shallow Clone"}]},{"@type":"WebSite","@id":"https:\/\/ranaghazzi.com\/#website","url":"https:\/\/ranaghazzi.com\/","name":"Rana Nasri Ghazzi","description":"Turning Data into Decisions","publisher":{"@id":"https:\/\/ranaghazzi.com\/#\/schema\/person\/d8ee34f53cb0df9faaf816fb5363a4cc"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ranaghazzi.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/ranaghazzi.com\/#\/schema\/person\/d8ee34f53cb0df9faaf816fb5363a4cc","name":"Rana Ghazzi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ranaghazzi.com\/wp-content\/uploads\/2025\/11\/logo.png","url":"https:\/\/ranaghazzi.com\/wp-content\/uploads\/2025\/11\/logo.png","contentUrl":"https:\/\/ranaghazzi.com\/wp-content\/uploads\/2025\/11\/logo.png","width":1024,"height":1024,"caption":"Rana Ghazzi"},"logo":{"@id":"https:\/\/ranaghazzi.com\/wp-content\/uploads\/2025\/11\/logo.png"},"url":"https:\/\/ranaghazzi.com\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/posts\/5816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5816"}],"version-history":[{"count":7,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/posts\/5816\/revisions"}],"predecessor-version":[{"id":5823,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=\/wp\/v2\/posts\/5816\/revisions\/5823"}],"wp:attachment":[{"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ranaghazzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}