<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sandeep Manocha on Medium]]></title>
        <description><![CDATA[Stories by Sandeep Manocha on Medium]]></description>
        <link>https://medium.com/@smanocha?source=rss-29acd73a59e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5CCn-hqY7ePRbZiVM4pvDw.jpeg</url>
            <title>Stories by Sandeep Manocha on Medium</title>
            <link>https://medium.com/@smanocha?source=rss-29acd73a59e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:43:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smanocha/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Databricks row-level security beyond open vs restricted tables]]></title>
            <link>https://medium.com/@smanocha/databricks-row-level-security-beyond-open-vs-restricted-tables-df6a1a0d2453?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/df6a1a0d2453</guid>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[abac]]></category>
            <category><![CDATA[rbac-access-control]]></category>
            <category><![CDATA[row-level-security]]></category>
            <category><![CDATA[data-security]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 06:39:28 GMT</pubDate>
            <atom:updated>2026-08-04T06:39:28.685Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, I will showcase a row-level security policy that filters certain tables so that some users can see all data in those tables, while other users can see only specific rows.</p><p>For example, Annie should see all orders, and Jack should see only US orders. On the customers table, Annie and Jack should both see only US data.</p><p>Hard part is Annie has wider access on the orders table, but not on the customers table, which should still follow region-specific filters.</p><h3>The easy part</h3><p>I implemented row-level security in Databricks using governed tags, policies, UDFs, and groups.</p><p>During initial discussions with the customer to showcase row-level security, I chose a simple use case. Based on regions such as U.S., the EU, Asia, or Canada, a user should only see rows for their own region. That is a very simple and basic use case for RLS, isn’t it?</p><p>So I created two governed tags: <strong>data_region</strong> and <strong>region_filter</strong>.</p><p>Allowed values for region_filter were <strong>Yes</strong> and <strong>No</strong> only. That tag is the gate for whether a table should be evaluated by the row-level policy. If it is set to Yes, the policy activates and runs the attached UDF. If it is set to No, the policy skips that table.</p><p>I applied the policy at the schema level. Any table in that schema tagged with <strong>region_filter = Yes</strong> gets the filter, without naming tables one by one in the policy.</p><p>Next, I tagged the <strong>data_region</strong> columns that hold the region values. These columns feed the filter condition into the UDF. After that, I created the policy and the UDF with the filtering logic. The UDF takes the region from the row and checks whether the caller is in the matching market group, for example, MARKET_US for a US row. Databricks documentation covers the how-to steps, so I will not repeat that here.</p><p>Finally, I created some groups and users. I used service principals so I could run notebooks as jobs under those identities. I also granted the usual table access and put people into groups such as MARKET_US for US rows and MARKET_EU for EU rows.</p><p>From that point on, work was simple. Apply the tag to the table, put users in the right groups, and it works as expected.</p><h3>The challenge starts here</h3><p>Then the customer asked a harder question.</p><p>How do we filter some tables so that a special condition applies: some users can see all data on those tables, while others stay restricted, and the rest of the tables still follow region-restricted access?</p><p>Our first solution could not cover that.</p><p>Switching <strong>region_filter</strong> to <strong>No</strong> turns off row filtering for everyone on that table, not only for Annie.</p><p>Adding Annie to every market group was another option. The UDF already builds the group name from the row, so I did not need to hard-code every region into the UDF. If Annie is in MARKET_US, MARKET_EU, and the rest, she passes every region row. That looks fine on orders until you notice the <strong>same check also runs on customers</strong>, because the customers table is also tagged Yes. Annie would then see every customer region, too. That is not what we wanted.</p><p>There is another problem with that approach. If Annie is in only some of the market groups, she sees only those regions. Keeping her <strong>membership list complete forever is fragile</strong>.</p><p>I also wanted to limit Annie’s broader access to specific tables, not to every table in the schema, with region filtering turned on.</p><p>At one point, creating an <strong>ORDERS_ALL</strong> group <strong>felt like the answer</strong>. Put Annie in ORDERS_ALL, code the UDF to accept that group, and she sees every order.</p><p>That <strong>does not work either</strong> if you only have the original <strong>Yes</strong> policy and UDF. The <strong>Yes</strong> UDF runs on every table tagged <strong>region_filter = Yes</strong>. The UDF does <strong>not know whether the query came from orders or customers</strong>. It only sees the region column and the caller’s groups. If ORDERS_ALL is honored inside that UDF, it is honored on customers too.</p><p>Ultimately, the core difficulty wasn’t just verifying group memberships. I required a solution in which certain filtered tables would operate under an expanded access level, while other tables would remain strictly limited.</p><h3>What I changed</h3><p>I kept the original Yes path for country-only tables. The customer’s table stayed on that tag value.</p><p>I extended <strong>region_filter</strong> with a third value: <strong>SelectiveAll</strong>.</p><p><strong>SelectiveAll</strong> still filters rows. It is not the same as No. The difference is that it also honors ORDERS_ALL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9PQH__J9fYanMCLrA8fYQ.png" /></figure><p>I also added:</p><ol><li>A second UDF that checks the market group or ORDERS_ALL</li><li>A second schema policy that runs only when region_filter = SelectiveAll</li><li>The ORDERS_ALL group for people like Annie</li><li>Orders tagged SelectiveAll</li><li>Customers left as Yes</li></ol><p>Annie is in MARKET_US and ORDERS_ALL. Jack is in MARKET_US.</p><p>On orders, Annie sees all regions because of ORDERS_ALL. On customers, that membership does nothing, because the Yes UDF never looks at ORDERS_ALL. Jack stays US-only on both tables.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X3rfgnmCOjuqb2bfakc7AA.png" /></figure><p>The last row is useful. Someone in only ORDERS_ALL sees all orders and no customer rows. The wider privilege stays on the tables that opted in. If that person also needs customers, add a market group.</p><p>A later request for someone like Raj, all orders plus EU customers, needed no new UDF and no new policy. Put Raj in MARKET_EU and ORDERS_ALL. Same tags. Same rules.</p><p><strong>Rule of thumb:</strong></p><ul><li>New person, same kind of access: change groups</li><li>New table, same kind of rule: change tags</li><li>New kind of question, such as filter by branch: create that rule once, then reuse it</li></ul><h3>Why two UDFs and two policies</h3><p>The two UDFs look almost the same:</p><pre>Yes:           are you in MARKET_&lt;region&gt;?<br>SelectiveAll:  are you in MARKET_&lt;region&gt;, or in ORDERS_ALL?</pre><p>Combining everything into a single, clever UDF is a tempting idea. However, that approach succeeds only if the UDF can identify the specific table that triggers the check. Unfortunately, that context is not available and isn’t passed along. While a row-level filter can access the region value in the column, it has no way to know which table provided that value during evaluation.</p><h3>Try it yourself</h3><ul><li>In the following code, replace <strong>catalog and schema</strong> names with your own.</li><li>Create the account groups similar to <strong>MARKET_US</strong>, <strong>MARKET_EU</strong>, <strong>MARKET_APAC</strong>, and <strong>ORDERS_ALL</strong>.</li><li>Add users or service principals to those groups outside SQL. I used SPs so that I could run the same notebook with different identities to see the results. <strong>This is my trick for impersonation</strong>.</li></ul><h3>1. Governed tags</h3><pre>CREATE GOVERNED TAG region_filter<br>COMMENT &#39;Table gate for region row filters&#39;<br>VALUES (&#39;Yes&#39;, &#39;No&#39;, &#39;SelectiveAll&#39;);<br><br>CREATE GOVERNED TAG data_region<br>COMMENT &#39;Marks the column that holds the region value for row filters&#39;;</pre><p>If <strong>region_filter</strong> already exists with only Yes and No:</p><pre>ALTER GOVERNED TAG region_filter SET VALUES (&#39;Yes&#39;, &#39;No&#39;, &#39;SelectiveAll&#39;);</pre><h3>2. UDFs</h3><pre>CREATE OR REPLACE FUNCTION catalog.schema.market_region_filter(region STRING)<br>RETURNS BOOLEAN<br>RETURN IS_ACCOUNT_GROUP_MEMBER(CONCAT(&#39;MARKET_&#39;, region));<br><br>CREATE OR REPLACE FUNCTION catalog.schema.market_region_filter_selective_all(region STRING)<br>RETURNS BOOLEAN<br>RETURN IS_ACCOUNT_GROUP_MEMBER(CONCAT(&#39;MARKET_&#39;, region))<br>    OR IS_ACCOUNT_GROUP_MEMBER(&#39;ORDERS_ALL&#39;);</pre><p>Grant execute so policies and callers can use them:</p><pre>GRANT EXECUTE ON FUNCTION catalog.schema.market_region_filter<br>  TO `account users`;<br><br>GRANT EXECUTE ON FUNCTION catalog.schema.market_region_filter_selective_all<br>  TO `account users`;</pre><h3>3. Policies</h3><pre>CREATE OR REPLACE POLICY market_access_yes<br>ON SCHEMA catalog.schema<br>COMMENT &#39;Region-only row filter for tables tagged region_filter=Yes&#39;<br>ROW FILTER catalog.schema.market_region_filter<br>TO `account users`<br>FOR TABLES<br>  WHEN has_tag_value(&#39;region_filter&#39;, &#39;Yes&#39;)<br>  MATCH COLUMNS has_tag(&#39;data_region&#39;) AS region_col<br>  USING COLUMNS (region_col);<br><br>CREATE OR REPLACE POLICY market_access_selective_all<br>ON SCHEMA catalog.schema<br>COMMENT &#39;Region or ORDERS_ALL for tables tagged region_filter=SelectiveAll&#39;<br>ROW FILTER catalog.schema.market_region_filter_selective_all<br>TO `account users`<br>FOR TABLES<br>  WHEN has_tag_value(&#39;region_filter&#39;, &#39;SelectiveAll&#39;)<br>  MATCH COLUMNS has_tag(&#39;data_region&#39;) AS region_col<br>  USING COLUMNS (region_col);</pre><h3>4. Tables and tags</h3><pre>CREATE TABLE IF NOT EXISTS catalog.schema.orders (<br>  order_id INT,<br>  region   STRING<br>);<br><br>CREATE TABLE IF NOT EXISTS catalog.schema.customers (<br>  customer_id INT,<br>  region      STRING<br>);<br><br>ALTER TABLE catalog.schema.orders<br>  SET TAGS (&#39;region_filter&#39; = &#39;SelectiveAll&#39;);<br><br>SET TAG ON COLUMN catalog.schema.orders.region data_region;<br><br>ALTER TABLE catalog.schema.customers<br>  SET TAGS (&#39;region_filter&#39; = &#39;Yes&#39;);<br><br>SET TAG ON COLUMN catalog.schema.customers.region data_region;</pre><h3>5. Grants for groups</h3><p>Row filters do not replace table privileges. Grant read access to the groups that should query the tables:</p><pre>GRANT USE CATALOG ON CATALOG catalog TO `MARKET_US`, `MARKET_EU`, `MARKET_APAC`, `ORDERS_ALL`;<br>GRANT USE SCHEMA ON SCHEMA catalog.schema TO `MARKET_US`, `MARKET_EU`, `MARKET_APAC`, `ORDERS_ALL`;<br><br>GRANT SELECT ON TABLE catalog.schema.orders<br>  TO `MARKET_US`, `MARKET_EU`, `MARKET_APAC`, `ORDERS_ALL`;<br><br>GRANT SELECT ON TABLE catalog.schema.customers<br>  TO `MARKET_US`, `MARKET_EU`, `MARKET_APAC`, `ORDERS_ALL`;</pre><p>Put Annie in MARKET_US and ORDERS_ALL. Put Jack in MARKET_US.</p><h3>6. Prove it with a notebook job</h3><p>Create a short notebook with two cells:</p><pre>SELECT * FROM catalog.schema.customers;SELECT * FROM catalog.schema.orders;</pre><pre>SELECT * FROM catalog.schema.orders;</pre><p>Run that notebook as a Databricks job three times, each time with a different run_as identity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6xuCjqzuHAsjI95vvn32g.png" /></figure><p>Same notebook. Same SQL. Different callers, different row sets. That is the whole proof.</p><h3>Conclusion</h3><p>I wanted to share this specific edge case and my strategy for addressing it by using governed tags, schema-level policies, UDF logic, and account groups. While this configuration provided a solution, more complicated requirements may exist. I would value your feedback on this architecture, any alternative methodologies you might suggest, or other complex scenarios you are interested in exploring further.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df6a1a0d2453" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Read from External Databricks Volumes — No External Table]]></title>
            <link>https://medium.com/@smanocha/read-from-external-databricks-volumes-no-external-table-d844787dde16?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d844787dde16</guid>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 22:31:44 GMT</pubDate>
            <atom:updated>2026-04-20T22:31:44.843Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*8LLTdWfFrYEQdBTewVxqRQ.png" /></figure><blockquote>Not a Medium member? You can read this story for free <a href="https://www.linkedin.com/article/edit/7451902265512099840/">here</a>↗.</blockquote><p>In one of my projects, I was archiving data to external volumes. Still, during rehydration, when a user tried to access the archived data, I was unable to create external tables pointing to those volumes.</p><p>So, the general question is, if we have data in an <strong>External Volume</strong> in Databricks, how would we read it?</p><p>You might initially think to create an <strong>external table</strong>, but you’ll soon see that’s not the best way. You’ve followed Databricks best practices by setting up an external volume linked to an external location, such as AWS S3, and your goal is simply to read data using the three-level namespace, such as <strong>catalog.schema.table</strong> structure. You might have done something along these lines.</p><pre>CREATE TABLE main.archive.claims_year_2020<br>USING DELTA<br>LOCATION &#39;/Volumes/main/archive/claims_vol/claims/year_2020&#39;</pre><p>But to your surprise, this will fail. Here are the possible errors you could see:</p><pre>LOCATION &#39;/Volumes/.../year_2020&#39;<br>  → [INVALID_PARAMETER_VALUE] Missing cloud file system scheme<br><br>LOCATION &#39;dbfs:/Volumes/.../year_2020&#39;<br>  → [UC_FILE_SCHEME_FOR_TABLE_CREATION_NOT_SUPPORTED]<br>    Creating table in Unity Catalog with file scheme dbfs is not supported.<br>    SQLSTATE: 0AKUC<br><br>LOCATION &#39;s3://&lt;bucket&gt;/&lt;volume-prefix&gt;/.../year_2020&#39;<br>  → [INVALID_PARAMETER_VALUE] Unsupported path operation PATH_CREATE_TABLE on volume</pre><p><strong><em>→ [INVALID_PARAMETER_VALUE] Unsupported path operation PATH_CREATE_TABLE on volume</em></strong></p><p>The last one is the error you actually care about. It’s UC saying, “<strong><em>This path is a volume, you can’t put a table on it.</em></strong>” The first two fail earlier, on URL scheme validation, before UC even gets to check the volume rule.</p><p>So the annoying part is that you usually hit the first two first, think it’s a syntax problem, try the underlying s3:// URL to work around it, and only then get the real answer.</p><h3>Why it happens</h3><p>UC has two different governance models:</p><ul><li><strong>Tables.</strong> Table grants: SELECT, MODIFY. Lineage tracks them as tables.</li><li><strong>Volumes.</strong> Volume grants: READ VOLUME, WRITE VOLUME. Treated as raw file access.</li></ul><p>Every path in UC has one owner. Once it’s used in a volume, the volume owns it. An external table on the same path would mean two sets of grants on the same bytes, with no clear answer to “who decides whether I can read this.”</p><p>It is not really a CREATE TABLE LOCATION issue, but rather about UC picking one owner per path.</p><h3>The fix</h3><p>Don’t create a table. Create a <strong>view</strong> over the path using delta. `path`:</p><pre>CREATE OR REPLACE VIEW main.archive.claims_year_2020 AS<br>SELECT * FROM delta.`/Volumes/main/archive/claims_vol/claims/year_2020`</pre><p>That’s it. The view lives in the catalog, the data lives in the volume, and neither side is stepping on the other’s governance.</p><p>Consumers need both:</p><ul><li>SELECT on the view.</li><li>READ VOLUME on the underlying volume.</li></ul><p>This may feel like “extra work” at first, but it is actually useful. You can grant the view widely and the volume narrowly, or vice versa — two separate knobs.</p><h3>What you lose by using views</h3><p>In my case, since I was working on data archive and selective rehydrate, none of the following was required, but its worth nothing them in case you have little different set of requirements.</p><ul><li><strong>No OPTIMIZE, VACUUM, or ZORDER</strong> on the view. These need a table. If the underlying Delta files need compaction, run it by path: OPTIMIZE delta.`/Volumes/…/year_2020`.</li><li><strong>No time travel through the view.</strong> SELECT * FROM view VERSION AS OF 5 doesn’t work. You have to time-travel the path directly: SELECT * FROM delta.`/Volumes/…/year_2020` VERSION AS OF 5.</li><li><strong>DESCRIBE EXTENDED shows view metadata, not Delta metadata.</strong> For stats and properties on the underlying table, DESCRIBE EXTENDED delta.`/Volumes/…/year_2020`.</li><li><strong>No ANALYZE TABLE on the view.</strong> Stats collection has to target the path.</li><li><strong>No INSERT INTO / MERGE INTO the view.</strong> Views are not write targets. Writes go by path.</li><li><strong>Some BI tools treat views as second-class.</strong> Catalog explorers sometimes filter views out by default. Worth checking before you migrate a dashboard.</li></ul><p>If you’re dealing with a read-mostly archive pattern like ours, this is not very important. However, if you’re working with a read-write table stored in a volume, then it might require adjustments.</p><h3>You can still write, just not as an external table.</h3><p>Most confusing part is this: “If I cannot CREATE TABLE LOCATION on a volume path, how do I write into it?”</p><p>The answer: you don’t use CREATE TABLE at all. You write the Delta files directly to the path via the DataFrame API. As long as your principal has WRITE VOLUME, it just works:</p><pre># First write — creates the Delta table on disk at the path<br>(spark.table(&quot;main.source.claims&quot;)<br>    .filter(&quot;year(event_date) = 2020&quot;)<br>    .write.format(&quot;delta&quot;).mode(&quot;overwrite&quot;)<br>    .save(&quot;/Volumes/main/archive/claims_vol/claims/year_2020&quot;))<br><br># Later appends<br>(spark.table(&quot;main.source.claims&quot;)<br>    .filter(&quot;year(event_date) = 2020 and event_date &gt; &#39;2020-06-01&#39;&quot;)<br>    .write.format(&quot;delta&quot;).mode(&quot;append&quot;)<br>    .save(&quot;/Volumes/main/archive/claims_vol/claims/year_2020&quot;))</pre><p>If you prefer SQL for appends once the path exists, use INSERT INTO delta. `path` also works:</p><pre>INSERT INTO delta.`/Volumes/main/archive/claims_vol/claims/year_2020`<br>SELECT * FROM main.source.claims<br>WHERE year(event_date) = 2020 AND event_date &gt; &#39;2020-06-01&#39;;</pre><p>Writing to the <strong>named catalog objects</strong> (tables that would appear in information_schema tables) is blocked, but not writing directly to the files.</p><h3>If you want to try it yourself, here’s some sample code</h3><p>To execute these statements, you will need a UC-enabled workspace, a catalog with write permissions, an External Location, a storage credential for a cloud prefix, and a SQL warehouse or cluster.</p><h3>One-time prep (skip if external location already exists)</h3><p>You can also try using the Databricks UI; I used it for this example.</p><pre>databricks storage-credentials create --json &#39;{<br>  &quot;name&quot;: &quot;views_demo_cred&quot;,<br>  &quot;aws_iam_role&quot;: {&quot;role_arn&quot;: &quot;arn:aws:iam::&lt;acct&gt;:role/&lt;role&gt;&quot;}<br>}&#39; --profile &lt;profile&gt;<br><br>databricks external-locations create --json &#39;{<br>  &quot;name&quot;: &quot;views_demo_loc&quot;,<br>  &quot;url&quot;: &quot;s3://&lt;bucket&gt;/views-demo&quot;,<br>  &quot;credential_name&quot;: &quot;views_demo_cred&quot;<br>}&#39; --profile &lt;profile&gt;</pre><h3>Catalog, Schema, Volume Layout</h3><p>A small tip for the layout. The catalog’s managed storage and the External Volume should be <strong>sibling prefixes</strong> under the same bucket, not one nested inside the other.</p><pre>s3://&lt;bucket&gt;/views-demo/<br>├── managed/         ← catalog managed storage<br>└── volumes/         ← External Volume(s) go here<br>    └── archive_vol/<br>        └── claims/<br>            └── year_2020/</pre><p>Not this:</p><pre>s3://&lt;bucket&gt;/views-demo/<br>└── managed/                 ← catalog managed storage<br>    └── volumes/             ← volume nested inside managed storage (avoid)<br>        └── archive_vol/</pre><p>UC will not reject the nested layout, but mixing managed storage with an external volume could make it very messy and difficult to manage.</p><pre>from pyspark.sql.functions import lit<br><br>CATALOG = &quot;views_demo&quot;<br>SCHEMA = &quot;archive&quot;<br>VOLUME = &quot;archive_vol&quot;<br><br>CATALOG_URL = &quot;s3://&lt;bucket&gt;/views-demo/managed&quot;   # catalog managed storage<br>VOLUME_URL  = &quot;s3://&lt;bucket&gt;/views-demo/volumes&quot;   # sibling prefix for volumes<br><br>spark.sql(f&quot;CREATE CATALOG IF NOT EXISTS {CATALOG} MANAGED LOCATION &#39;{CATALOG_URL}&#39;&quot;)<br>spark.sql(f&quot;CREATE SCHEMA IF NOT EXISTS {CATALOG}.{SCHEMA}&quot;)<br>spark.sql(f&quot;&quot;&quot;<br>    CREATE EXTERNAL VOLUME IF NOT EXISTS {CATALOG}.{SCHEMA}.{VOLUME}<br>    LOCATION &#39;{VOLUME_URL}/{VOLUME}&#39;<br>&quot;&quot;&quot;)<br><br>for year in [2020, 2021, 2022]:<br>    path = f&quot;/Volumes/{CATALOG}/{SCHEMA}/{VOLUME}/claims/year_{year}&quot;<br>    (spark.range(0, 1000)<br>        .withColumn(&quot;year&quot;, lit(year))<br>        .withColumn(&quot;amount&quot;, lit(year) * 0.1)<br>        .write.format(&quot;delta&quot;).mode(&quot;overwrite&quot;).save(path))<br>    print(f&quot;Wrote {path}&quot;)</pre><h3>Watch CREATE TABLE fail.</h3><pre>path_2020 = f&quot;/Volumes/{CATALOG}/{SCHEMA}/{VOLUME}/claims/year_2020&quot;<br>dbfs_path = f&quot;dbfs:{path_2020}&quot;<br>s3_path   = f&quot;{VOLUME_URL}/{VOLUME}/claims/year_2020&quot;<br><br>for label, path in [(&quot;no scheme&quot;, path_2020), (&quot;dbfs:&quot;, dbfs_path), (&quot;s3://&quot;, s3_path)]:<br>    try:<br>        spark.sql(f&quot;&quot;&quot;<br>            CREATE TABLE {CATALOG}.{SCHEMA}.claims_year_2020_ext<br>            USING DELTA<br>            LOCATION &#39;{path}&#39;<br>        &quot;&quot;&quot;)<br>        spark.sql(f&quot;DROP TABLE {CATALOG}.{SCHEMA}.claims_year_2020_ext&quot;)<br>        print(f&quot;[{label}] unexpectedly succeeded&quot;)<br>    except Exception as e:<br>        print(f&quot;[{label}] failed: {str(e)[:200]}&quot;)</pre><p>Output:</p><pre>[no scheme] failed: [INVALID_PARAMETER_VALUE] Missing cloud file system scheme<br>[dbfs:]     failed: [UC_FILE_SCHEME_FOR_TABLE_CREATION_NOT_SUPPORTED] Creating table in Unity Catalog with file scheme dbfs is not supported. SQLSTATE: 0AKUC<br>[s3://]     failed: [INVALID_PARAMETER_VALUE] Unsupported path operation PATH_CREATE_TABLE on volume</pre><h3>The view pattern that works</h3><pre>spark.sql(f&quot;&quot;&quot;<br>    CREATE OR REPLACE VIEW {CATALOG}.{SCHEMA}.claims_year_2020 AS<br>      SELECT * FROM delta.`{path_2020}`<br>&quot;&quot;&quot;)<br><br>display(spark.table(f&quot;{CATALOG}.{SCHEMA}.claims_year_2020&quot;).limit(5))</pre><h3>Grants for a read-only consumer</h3><p>Only SELECT is not enough; we also need to grant READ VOLUME.</p><pre>READER = &quot;&lt;reader-application-id-uuid&gt;&quot;<br><br>spark.sql(f&quot;GRANT USE CATALOG ON CATALOG {CATALOG} TO `{READER}`&quot;)<br>spark.sql(f&quot;GRANT USE SCHEMA  ON SCHEMA  {CATALOG}.{SCHEMA} TO `{READER}`&quot;)<br>spark.sql(f&quot;GRANT SELECT      ON VIEW    {CATALOG}.{SCHEMA}.claims_year_2020 TO `{READER}`&quot;)<br>spark.sql(f&quot;GRANT READ VOLUME ON VOLUME  {CATALOG}.{SCHEMA}.{VOLUME} TO `{READER}`&quot;)</pre><h3>Cleanup Schema and Catalog, if needed</h3><pre>spark.sql(f&quot;DROP SCHEMA IF EXISTS {CATALOG}.{SCHEMA} CASCADE&quot;)<br>spark.sql(f&quot;DROP CATALOG IF EXISTS {CATALOG} CASCADE&quot;)</pre><p>Schema drop cascades to the volume. The S3 data stays unless you delete it yourself.</p><h3>Takeaway</h3><p>UC keeps volumes and external tables on separate paths on purpose to avoid double ownership of the same location using two different constructs. Yet if we need a three-level namespace to access the data, we can create views to that location. In my case, it was sufficient, as I was building an archive solution. During the archive, when needed, we will create read-only views for users who need to see older data, such as auditors or compliance officers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d844787dde16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Databricks Lakeflow Jobs — Async Wait]]></title>
            <link>https://medium.com/@smanocha/databricks-lakeflow-jobs-async-wait-1ec26f5eef81?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ec26f5eef81</guid>
            <category><![CDATA[databricks-lakeflow]]></category>
            <category><![CDATA[lakeflow]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 04:40:08 GMT</pubDate>
            <atom:updated>2026-04-08T05:02:58.809Z</atom:updated>
            <content:encoded><![CDATA[<p>Not a Medium member? You can read this story for free <a href="https://www.linkedin.com/pulse/databricks-lakeflow-jobs-async-wait-sandeep-manocha-ms-mba--eyp9c/?trackingId=dlRv%2B23pRWGouBUcwLoHLA%3D%3D">here</a> ↗.</p><p><a href="https://docs.databricks.com/aws/en/jobs/">Lakeflow jobs</a> offer a highly reliable way to orchestrate tasks without the hassle of managing infrastructure. It includes many powerful features. But there was one requirement: we had to submit the lakeflow jobs to another system via REST APIs. We didn’t want to break the dependency chart (DAG), and also didn’t want to wait for the other system to finish the job while keeping the cluster running. Since there is no native feature for such callback waits, we developed a solution that will be the focus of this blog.</p><p>Initially, we began by dividing jobs into separate workflows and managing their dependencies using a custom table. Although this approach would have worked, the entire workflow wouldn’t have been visible as a single unit unless we built a custom UI, and we would have had to recode many features available in Lakeflow jobs. The initial approach was to break the complete workflow into segments and maintain dependencies in the Delta table. Something like maintaining metadata such as</p><p><em>Job_Segment_1_Bronze — depends on — None</em></p><p><em>Job_Segment_2_Silver — depends on — Job_Segment_1_Bronze</em></p><p><em>Job_Segment_3_API — depends on — Job_Segment_2_Silver</em></p><p><em>Job_Segment_4_Gold — depends on — Job_Segment_3_Gold</em></p><p>And use this information in Resume Runner to decide what to run next. This information is stored in the Delta table, and there wasn’t an easy way to connect all four components, let alone managing edge cases during failures and re-tries from Lakeflows itself.</p><p>Motivated to utilize as many Lakeflow features as possible, reduce the technical burden, and visualize the entire flow, we explored the Repair functionality (<a href="https://docs.databricks.com/api/workspace/jobs/repairrun">link</a>), a hidden gem. The idea was a simple alternative to our initial plan: we would manage the state only for API tasks in our workflows and let Lakeflow handle the rest of the workflow dependencies and state.</p><p>We built the solution around this core idea and created reusable components, such as Submit REST API Calls, check API Status, and If-then-else tasks in Lakeflow. Now, whenever we submit a REST API call using these components, we log an entry in the api_log_table with a status like CALL_SUBMITTED. During the REST API callback, the table is updated for the same record with a status such as CALLBACK_RECEIVED, which signals that the job should be resumed. The following picture illustrates this core idea.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5GaHsZmB6A1UNLLSZe0Ow.png" /><figcaption>High-level</figcaption></figure><p>Order of the REST API calls looked something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sY-B2Ld3avwBq58fqWRA7g.png" /><figcaption>Rest API Calls Order</figcaption></figure><p>We develop the following core components to implement the solution</p><p><strong>Repair Job</strong> — There were multiple options to resume the lakeflow job.</p><ol><li><strong>Direct</strong> — The callback from bridge_api can resume the Lakeflow job directly, since it contains all the information we sent in the payload. It is not a bad option for a system if an immediate resume is required.</li><li><strong>Indirect</strong> — We choose this option. Update the api_log_table with status such as <strong>CALLBACK_RECEIVED</strong>, which the Repair Runner would pick to resume the job for that specific task and all downstream dependencies. Although we could have used table update triggers, since it was a weekly batch job, we decided to schedule Repair Runner with an interval of 15 mins (choose based on SLAs).</li></ol><p><strong>API Log Table</strong></p><p>One logical row per (pipeline_run_id, task_name) — the orchestration layer updates it as the external workflow progresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xRub6hzs-Bhu6Ae6Pqz0A.png" /><figcaption>API Log Table Schema</figcaption></figure><p>pipeline_run_id + task_name (and optionally metadata) identify exactly which Databricks run to <strong>repair</strong> and from which point downstream tasks may execute.</p><p><strong>Call Task</strong> — This is a reusable Python Notebook we use whenever we need to submit the REST API. We passed parameters such as base-url, submit-endpoint, Pipeline ID(not Lakeflow name or ID, but a custom name so that we can track it across different tasks), Pipeline Run ID (Lakeflow Run ID), task ID(name of task as this is what Lakeflow REST APIs accept), we stored some of this metadata in JSON config files, so that we can map them to actual values rather passing each value as parameters.</p><p><strong>Callback Check</strong> — Repair Job would call the Callback Check task, followed immediately by the Submit task. This helped us gatekeep the flow, in case we received statuses other than CALLBACK_RECEIVED and wanted to process them as well. Also, this would help pause the flow immediately after submitting the job for the first time.</p><p><strong>If-Then-Else Task</strong>: This checks the variable set by the <strong>Callback Check</strong> task and determines whether to execute the next step or halt the flow.</p><p>An <strong>end-to-end flow</strong> for a simple workflow would be as follows: during the initial run, zs_call_check creates the variable <strong>is_callback_received</strong> and sets it to false. During a <a href="https://docs.databricks.com/api/workspace/jobs/repairrun">repair run</a>, if a callback is received, the variable is updated to true, allowing the flow to proceed to the final_output task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qyi8sWtuor91lDhwMOV50Q.png" /><figcaption>Sample Flow</figcaption></figure><p><strong>APIs</strong></p><p>Production system had actual API endpoints, but to facilitate development and testing, I created two mock REST API endpoints using Databricks Apps</p><ol><li><strong>bridge_api</strong>: In a real application, this was built using an AWS Lambda function. It served as a bridge between Databricks and another system (let’s say system_x). But development and testing were just waiting for 60 seconds, and then update the API Log Table with status CALLBACK_RECEIVED</li><li><strong>System_x_api</strong>: This api was provided by System X. It was restricted to talk to the AWS Lambda function, not directly to Databricks. Also, a mock API is waiting for 30 seconds before sending a callback to bridge_api</li></ol><p>Using this approach, we <strong>successfully</strong> <strong>minimized</strong> status tracking across workflows as we initially envisioned and used Lakeflow to manage dependencies and tracking. It also enabled us to present the entire workflow in a single view, enhancing readability and debugging. Most importantly, we could terminate the flow and free up the cluster to avoid charges while waiting for a response from the other system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ec26f5eef81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TEST Framework to Help Customers]]></title>
            <link>https://medium.com/@smanocha/test-framework-to-help-customers-91ba8e1a3683?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/91ba8e1a3683</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[consulting]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 18:07:43 GMT</pubDate>
            <atom:updated>2026-04-02T18:07:43.847Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Trust</strong>, <strong>Empathy</strong>, <strong>Solution</strong>, and <strong>Technology</strong></blockquote><p>With 18 years of experience in Data Warehousing and Analytics, I have spent the last 5 years as a dedicated consultant, including at Google and, more recently, at Databricks as a Resident Solution Architect. Having partnered with many customers during this period, I developed this framework to maximize value for my customers. My ultimate goal is to guide customers in achieving their objectives and goals.</p><p>The main pillars of my framework are <strong>Trust</strong>, <strong>Empathy</strong>, <strong>Solution</strong>, and <strong>Technology</strong>, so I call it <strong>TEST</strong>. Let me explain it with some examples and how I apply it.</p><h3>Trust</h3><p>Let’s start with the first and one of the most important aspects: <strong>Trust</strong>. It is the most important because if your customers trust that you can solve their problems, life becomes easier for all parties. You might not know all the answers, but if your customer trusts you, they know that, given some time, you will be able to solve it. Trust is also a two-way street; as a consultant, I also take time to trust my customers, but it should start with me. Since the customer has paid for my services, it is my duty to help them and, with honesty and effort, provide solutions. Trust is also very <strong>slippery</strong>; it is hard to earn but <strong>very, very easy to lose</strong>. In one internal call with a sales representative, I lost his trust in the first five minutes, not because I said anything wrong, but because he interpreted it differently than I intended. So, it is also very important to acknowledge where the other person is coming from, why they are engaging with you, what problem they are facing, and why they want it solved. <strong>Empathy</strong> plays a big role at this point.</p><h3><strong>Empathy</strong></h3><p><strong>Empathy</strong>, for me, is about truly walking in the customer’s shoes: understanding their pain points, the driving reasons behind their pursuits, and the pressures they might be facing. Ultimately, the people I interact with are also professionals at other companies facing challenges similar to my own. One thing is clear: it’s incredibly hard to <strong>fake empathy </strong>in the long term. You might manage it for a call or two, but eventually, the customer will pick up the clues. So, you must be genuine.</p><p>But how can you be genuine? Let’s pick a situation from our daily life. If I paid someone to do a job, let’s say paint my house, and they failed to deliver it the way I wanted, I would feel frustrated and angry. Assuming something similar has happened to almost all of us at one point, I hope you all can relate. I never want to be the one who causes that pain.</p><p>Furthermore, I have a <strong>learning and builder mindse</strong>t. I know some things, but not everything, so every customer question, requirement, or issue is a valuable learning experience. I also don’t think I am the smartest or dumbest person in the room; I am there to <strong>help my customer</strong> achieve their goals, so I share my opinions and listen to others, keeping the conversation more engaging.</p><p><strong>Listening</strong> is one of the most important skills for fully understanding customer pain points and truly empathizing. Yet, this one is most <strong>underrated</strong> because, in the act of listening, no one can see you performing, and that sometimes causes uncomfortable feelings inside us. We fear that people might think I am not contributing, so it is always helpful to keep acknowledging during the conversation, so that people feel heard and understood, and you feel engaged.</p><h3><strong>Solution</strong></h3><p>Now is the time I can jump into the third section, <strong>Solution</strong>. Now I know what the customer is struggling with and why, what their timelines are, who the stakeholders are, and what would happen if we miss the goal or timelines. So now is the time to go back to the whiteboard and explore the solution and alternative approaches. I prefer to think about the high-level solution first and then collaborate with the customer implementation teams to gather feedback. It becomes a collaborative exercise rather than playing hero; this not only helps me find the solution the customer is looking for but also hardens the trust and empathy we just discussed. Earning trust is not a one-time activity — as I said earlier, it is slippery — so we must have genuine empathy. Once we have a solution that fits the customer’s budget and timelines, we can move on to <strong>Technology</strong>.</p><h3><strong>Technology</strong></h3><p>At this point, we should have a pretty solid idea about the problem at hand, a feasible solution, and the actors involved. With all this information, we can start adding technical components like architecture diagrams, data modeling, security, data governance, etc. (I am talking about Data solutions, but it can be anything related to the technology or tools you use). Create a pros/cons list if we need to decide between, say, Delta and Iceberg. Do some PoCs to validate our intuitions, create project plans, tasks, checkpoints, validations, and benchmarks. All this helps with the actual development and implementation of the solution we have proposed.</p><p>Not only does technology help my customers, but it also helps me. For example, I use AI tools, such as NotebookLM, to organize my thinking and review meeting notes, create mind-maps of all aspects of the solution, and help me create some slides for high-level thinking.</p><p>In the end, you should honestly work with your customers, engage them as much as possible without wasting anyone’s time, and be smart about bringing in the right topics at the right time, which is crucial for your customers’ success and yours. This framework is just a mind map to guide you through this process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91ba8e1a3683" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Move From Answers to Validated Solutions as a Resident Solutions Architect]]></title>
            <link>https://medium.com/@smanocha/vibe-consulting-how-i-move-from-answers-to-validated-solutions-as-a-resident-solutions-architect-e6845bdcc065?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6845bdcc065</guid>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Sat, 28 Feb 2026 06:19:45 GMT</pubDate>
            <atom:updated>2026-03-04T05:40:20.476Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I work as a Resident Solutions Architect in Databricks Professional Services. In simple words, I work very closely with customers and help them solve real problems on the Databricks platform.</p><p>For me, consulting is not just about giving answers from documentation or theory. It is about helping customers <strong>build solutions</strong>, validate them, and bridge the gap between product features and real-world use cases.</p><h3>My Role: Bridging Product and Reality</h3><p>As an RSA, I am often the technical face for the customer. Customers don’t come with clean textbook questions. They come with real problems. Some examples of the kind of questions I get:</p><ul><li>Should we use Serverless or Classic compute for specific data which has 15 minutes of SLA?</li><li>How do we implement row and column level security at scale but still adjust it for each department?</li><li>How do we design disaster recovery on Databricks platform?</li><li>Streaming vs batch pipelines consdering cost and SLA?</li><li>Liquid Clustering with Predictive Optimization — when does it actually help?</li><li>Spark Declarative Pipelines vs standard Spark processing? Why should we use one or the other and which of them is cheaper?</li><li>Incremental processing and SCD types in Declarative Pipelines</li><li>How to use Auto Loader effectively and manage schema evolution</li><li>Deploying Serving Endpoints and validating LLM outputs using MLflow</li></ul><p>Even when an engagement is scoped, customers naturally ask broader questions because they trust us as advisors.</p><h3>The Hidden Work: Research Behind Every Answer</h3><p>Customers see the final answer. They don’t see the research loop behind it. When I don’t have an immediate answer, my process looks something like this:</p><ul><li>Read documentation and use NotebookLM to really understand the concepts from different prespective.</li><li>Talk to internal experts and sometimes product managers</li><li>Recreate the problem in a controlled environment and validate with hands-on</li><li>Then respond with confidence</li></ul><p>This research burden is real. And this is exactly where GenAI is helping a lot.</p><h3>My AI-Powered Consulting Stack</h3><p>I use some specific GenAI tools to help me with day to day tasks:</p><h3>Research</h3><ul><li>Gemini for theoretical understanding</li><li>NotebookLM to understand the product documentation combined with specific needs. Mind Map feature helps me quickly see the big picture and key focus areas.</li><li>Perplexity for aggregating the search results focused on the questions at hand.</li></ul><p>This helps me focus on what actually matters for the use case instead of reading hundreds of pages blindly.</p><h3>Solutioning</h3><ul><li>White boarding &amp; conceptualizing the problem and possible solutions using Lucid Chart or Draw.IO</li><li>Cursor for Coding along with <a href="https://github.com/databricks-solutions/ai-dev-kit">AI Dev Kit </a>from Databricks and Context7 MCP for SDK signatures</li></ul><h3>Validation (Most Important)</h3><p>This is where the real value comes: This not only solidifies my solution but also builds confidence that I truly understand what I am talking about because:</p><ul><li>I have tested it before discussing it with the customer.</li><li>Figured how limitations might be hindering customer and how we can solve them</li><li>Showing working examples to customers</li></ul><p>This is the difference between advice and solutioning.</p><h3>Case Study 1: Observability Using Databricks System Tables</h3><p>In one engagement, a customer needed better observability into platform usage, cost patterns, and workload behavior. Instead of giving high-level guidance and just pointing them to online documentation, I coded a prototype for observability solution based on actual customer requirements. Instead of saying “you can build observability,” I showed them how it looks using their patterns. That changed the quality of the conversation completely.</p><h3>Case Study 2: External Storage &amp; Credentials Playbook (Validated Step-by-Step)</h3><p>Another use case involved creating a playbook for setting up external storage and credentials properly. This included setting:</p><ul><li>AWS IAM self-assuming roles</li><li>S3 bucket permissions</li><li>SNS and SQS configuration for file events</li><li>Storage credentials and external locations</li></ul><p>I took LLM help to structure the initial playbook steps and followed them manually to validate. By the end, I shared a <strong>validated and executable playbook</strong>, not just theoretical documentation.</p><p>This saved the customer a lot of trial and error. It also helped their InfoSec team ask more targeted questions about IAM roles and move much faster in their review process.</p><h3>Case Study 3: Understanding Pixel Accelerator for DICOM Processing</h3><p>In another scenario, I needed to showcase Pixel (accelerator solution) for processing DICOM images. The documentation was extensive and could take a long time to fully digest. Customer’s use case was very specific to just use data processing part but not the Dicom Viewer App.</p><p>I used LLM to walk me through the relevant parts of the solution instead of reading everything end-to-end. I used actual code for getting my answers along with online documentation. This approach made me move faster, but still grounded in truth.</p><p>I even identified a bug during this process and reported it internally to the accelerator owner.</p><h3>Customer Empathy</h3><p>When I recreate customer problems: I see the same errors they see, understand their friction points, and design more realistic solutions. It shows the customer that we are not just advising verbally, but helping them visualize solution.</p><h3>Reality Check: Where LLMs Still Fall Short</h3><p>LLMs are powerful, but not perfect. From my experience:</p><ul><li>They generate too much code</li><li>Sometimes over-engineer simple problems</li><li>Not always aware of enterprise constraints</li><li>Weak in validating architecture decisions</li></ul><p>That is why I constantly guide the prompts like: “Generate minimal PoC code. Don’t overcomplicate.” My goal is not production-ready code from LLMs. My goal is <strong>fast PoC validation</strong> to understand flow, constraints, and feasibility.</p><p>For architecture, governance, and enterprise design LLMs are still <strong>not</strong> <strong>good</strong>, <strong>human judgment is still critical</strong>.</p><h3>Final Thoughts</h3><p>Earlier, a PoC exploration could take weeks: reading docs, writing scratch code, testing multiple approaches. But now, with <strong>disciplined</strong> use of LLMs, I can move faster with prototyping, validation, and discovery . It also helps uncover edge cases we might not think about in initial discussions.</p><p>GenAI and LLMs are not replacing consulting expertise. They are amplifying it — if used correctly. At the end of the day, this approach helps build trust. Customers see that I am taking an extra steps — not only advising, but actively helping them solve problems in a practical and validated way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6845bdcc065" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slowly Changing Dimension (SCD) Type 2 with Delta MERGE in Databricks]]></title>
            <link>https://medium.com/@smanocha/slowly-changing-dimension-scd-type-2-with-delta-merge-in-databricks-2736fba1a10f?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2736fba1a10f</guid>
            <category><![CDATA[scd-type-2]]></category>
            <category><![CDATA[data-warehousing]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[delta-lake]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 04:28:40 GMT</pubDate>
            <atom:updated>2025-09-17T15:16:32.947Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re already familiar with Slowly Changing Dimension (SCD) Type 2, you know it’s a critical concept for tracking data history. My goal here <strong>isn’t to rehash the theory</strong>, but to show you how to implement it efficiently on the Databricks Platform using the powerful Delta file format.</p><p>Let’s dive into the practical hands-on exercise.</p><h3>First, understand the three cases in MERGE</h3><p>When you MERGE a source into a target, you’re saying:</p><p>For each row, check if the merge condition matches. Depending on whether a match is found (and where), do something.</p><p>There are three situations:</p><p><strong>a) WHEN MATCHED</strong></p><ul><li><strong>Condition</strong>: A row exists in both source and target based on merge_condition.</li><li><strong>Action</strong>: You usually UPDATE or DELETE the target row.</li></ul><p>👉 Example use in SCD2: If the record hasn’t changed, you might <strong>do nothing</strong>. If it has changed, you may expire the old record.</p><p><strong>b) WHEN NOT MATCHED BY TARGET</strong></p><ul><li><strong>Condition</strong>: Row exists in source but not in target.</li><li><strong>Action</strong>: Typically means new row → insert into target.</li></ul><p>👉 Example use in SCD2: <strong>Insert</strong> a completely new dimension member that never existed before.</p><p><strong>c) WHEN NOT MATCHED BY SOURCE</strong></p><ul><li><strong>Condition</strong>: Row exists in the target but not in the source.</li><li><strong>Action</strong>: You can DELETE or UPDATE it.</li></ul><p>👉 Example use in SCD2: You may <strong>expire rows</strong> that no longer appear in the source system (soft-delete), or you can ignore them depending on business rules.</p><p>How to implement <strong>Slowly Changing Dimension (SCD) Type 2</strong> using <strong>Databricks Delta Lake MERGE</strong>.<br>We will cover all three cases:</p><ol><li><strong>Updates</strong> (attribute changes → expire old row, insert new row)</li><li><strong>Inserts</strong> (new dimension members)</li><li><strong>Deletes</strong> (soft delete rows missing from source)</li></ol><p>We’ll use a simple dim_customer table to track customers with changing attributes (e.g., city).</p><h3>Step 1: Create the target SCD2 dimension table</h3><pre>USE CATALOG &lt;Catalog-Name&gt;;<br>USE SCHEMA &lt;Schema-Name&gt;;</pre><pre>DROP TABLE IF EXISTS dim_customer;<br><br>CREATE TABLE dim_customer (<br>    customer_id STRING,<br>    name STRING,<br>    city STRING,<br>    effective_start_date DATE,<br>    effective_end_date DATE,<br>    is_current BOOLEAN<br>) USING DELTA;</pre><h3>Step 2: Seed initial data</h3><pre>-- Insert initial customers<br>INSERT INTO dim_customer VALUES<br>  (&#39;1&#39;, &#39;John Doe&#39;, &#39;Memphis&#39;, DATE &#39;2023-01-01&#39;, NULL, TRUE),<br>  (&#39;2&#39;, &#39;Jane Smith&#39;, &#39;Chicago&#39;, DATE &#39;2023-02-01&#39;, NULL, TRUE);<br><br>-- Check initial state<br>SELECT * FROM dim_customer ORDER BY customer_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSQcbA3Obqqu80sl5FWARw.png" /><figcaption>Initial Data</figcaption></figure><h3>Step 3: Create a staging table with a new snapshot</h3><pre>DROP TABLE IF EXISTS staging_customer;<br><br>CREATE TABLE staging_customer (<br>    customer_id STRING,<br>    name STRING,<br>    city STRING,<br>    ingest_ts DATE<br>) USING DELTA;</pre><h3>Insert latest snapshot:</h3><ul><li>Customer 1 moved from Memphis → Austin</li><li>Customer 2 deleted</li><li>Customer 3 is new</li></ul><pre>INSERT INTO staging_customer VALUES<br>  (&#39;1&#39;, &#39;John Doe&#39;, &#39;Austin&#39;, DATE &#39;2023-06-01&#39;),<br>  (&#39;3&#39;, &#39;Mike Lee&#39;, &#39;Dallas&#39;, DATE &#39;2023-06-01&#39;);<br><br>SELECT * FROM staging_customer;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*ClZXxGwaY37a1wMxBgmcdw.png" /><figcaption>Data Changes Coming</figcaption></figure><pre>SELECT * FROM dim_customer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISZkgYjqNJIdVvVda5kHgQ.png" /><figcaption>Existing Data in dim_customer</figcaption></figure><h3>Step 4: Perform MERGE with SCD Type 2 logic</h3><p>Let’s look at the data first</p><pre>WITH updates AS (<br>  SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY ingest_ts DESC) AS rn<br>  FROM staging_customer<br>),<br>de_dup AS (<br>  SELECT customer_id, name, city, ingest_ts<br>  FROM updates WHERE rn = 1<br>),<br><br>-- Rows for INSERT (new active versions)<br>staged_new_versions AS (<br>  SELECT NULL AS merge_key, d.customer_id, d.name, d.city, d.ingest_ts AS effective_start_date<br>  FROM de_dup d<br>  JOIN dim_customer t<br>    ON d.customer_id = t.customer_id AND t.is_current = TRUE<br>  WHERE (t.name &lt;&gt; d.name OR t.city &lt;&gt; d.city)<br>),<br><br>-- Rows for UPDATE (expire current)<br>staged_match_rows AS (<br>  SELECT d.customer_id AS merge_key, d.customer_id, d.name, d.city, d.ingest_ts AS effective_start_date<br>  FROM de_dup d<br>),<br><br>-- Union both<br>staged_updates AS (<br>  SELECT * FROM staged_new_versions<br>  UNION ALL<br>  SELECT * FROM staged_match_rows<br>)<br>SELECT * FROM staged_updates</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*QW-Mmybm7-84HBTAGxaTNA.png" /><figcaption>Data used in MERGE</figcaption></figure><h3>Let’s Merge Now</h3><pre>WITH updates AS (<br>  SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY ingest_ts DESC) AS rn<br>  FROM staging_customer<br>),<br>de_dup AS (<br>  SELECT customer_id, name, city, ingest_ts<br>  FROM updates WHERE rn = 1<br>),<br><br>-- Rows for INSERT (new active versions)<br>staged_new_versions AS (<br>  SELECT NULL AS merge_key, d.customer_id, d.name, d.city, d.ingest_ts AS effective_start_date<br>  FROM de_dup d<br>  JOIN dim_customer t<br>    ON d.customer_id = t.customer_id AND t.is_current = TRUE<br>  WHERE (t.name &lt;&gt; d.name OR t.city &lt;&gt; d.city)<br>),<br><br>-- Rows for UPDATE (expire current)<br>staged_match_rows AS (<br>  SELECT d.customer_id AS merge_key, d.customer_id, d.name, d.city, d.ingest_ts AS effective_start_date<br>  FROM de_dup d<br>),<br><br>-- Union both<br>staged_updates AS (<br>  SELECT * FROM staged_new_versions<br>  UNION ALL<br>  SELECT * FROM staged_match_rows<br>)<br><br>-- Final MERGE with all 3 cases<br>MERGE INTO dim_customer AS target<br>USING staged_updates AS source<br>  ON target.customer_id = source.merge_key<br><br>-- Case A: Attribute change → expire old row<br>WHEN MATCHED AND target.is_current = TRUE<br>  AND (target.name &lt;&gt; source.name OR target.city &lt;&gt; source.city)<br>THEN UPDATE SET<br>  target.is_current = FALSE,<br>  target.effective_end_date = DATE_SUB(source.effective_start_date, 1)<br><br>-- Case B: New or changed → insert new active record<br>WHEN NOT MATCHED BY TARGET<br>THEN INSERT (customer_id, name, city, effective_start_date, effective_end_date, is_current)<br>     VALUES (source.customer_id, source.name, source.city, source.effective_start_date, NULL, TRUE)<br><br>-- Case C: Missing in source → expire record<br>WHEN NOT MATCHED BY SOURCE AND target.is_current = TRUE<br>THEN UPDATE SET<br>  target.is_current = FALSE,<br>  target.effective_end_date = current_date();</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vhS1c-uJ4L-gDWd5hTuSDQ.png" /><figcaption>affected rows counts</figcaption></figure><h3>Step 5: Inspect results</h3><pre>SELECT * FROM dim_customer ORDER BY customer_id, effective_start_date;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxZ3vnKvh6nUn5aQCGc-yQ.png" /><figcaption>final results</figcaption></figure><h3>Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*Xb_hHRJ7zNI_Evs7NBRs-A.png" /><figcaption>before and after</figcaption></figure><h3>Conclusion</h3><p>SCD Type 2 is a classic concept that’s still heavily used today. While it was straightforward to implement on single-host systems like Oracle Exadata or SQL Server, it became a much harder problem in the world of distributed computing, which favors appending data over updates and deletes.</p><p>Fortunately, Delta Lake solves this challenge beautifully with its MERGE statement and ACID compliance. This article shows you how to take a well-known concept like SCD2 and implement it with the power of the Delta format.</p><p>I hope this was helpful. If you have any questions, feel free to drop a comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2736fba1a10f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Complete Data Story: Bringing Your External Lineage to Databricks Unity Catalog]]></title>
            <link>https://medium.com/@smanocha/building-a-complete-data-story-bringing-your-external-lineage-to-databricks-unity-catalog-fb57ff276f20?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb57ff276f20</guid>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[data-mesh]]></category>
            <category><![CDATA[trust]]></category>
            <category><![CDATA[unity-catalog]]></category>
            <category><![CDATA[data-lineage]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Fri, 29 Aug 2025 03:39:42 GMT</pubDate>
            <atom:updated>2026-05-12T20:42:56.206Z</atom:updated>
            <content:encoded><![CDATA[<p>Bring Your Own Lineage on Databricks</p><p>In today’s data-driven world, understanding the journey of your data is more critical than ever. It’s about more than just knowing what data you have; it’s about building trust in the data you’re using and being able to do a better impact analysis.</p><p>Think about it: won’t it be nice if you knew exactly how the data in your most important report was sourced in the first place?</p><h3>“Bring Your Own Lineage” — A New Feature to the Rescue!</h3><p>Databricks recently released this new feature, which allows you to bring those external objects and their lineage into Databricks. You can now create a truly end-to-end view of your data’s flow. While the UI is perfect for quick experiments, if you truly want to automate this process and integrate it into your data pipelines, you’ll need to use the REST API.</p><p>I’ve created some examples to simplify the API calls and get you started. The following code demonstrates how to:</p><ul><li>Create external metadata objects, representing systems like PostgreSQL, Snowflake, and PowerBI.</li><li>Define lineage relationships between these external objects.</li><li>Create lineage between external and Unity Catalog objects in both upstream and downstream directions.</li><li>Clean up the created objects.</li></ul><h3>Let’s get started</h3><p>Take a look at the code examples below. They’re a great starting point for integrating your custom lineage into your data governance processes.</p><p>First, let’s set up the Python dependencies and some variables.</p><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>Databricks Lineage API Demo <br>==================================================<br><br>This file contains examples for creating external objects and lineage relationships<br>using the Databricks Lineage API. Each section can be run as a separate cell in IPython.<br><br>Requirements:<br>- requests library<br>- Valid Databricks workspace URL and token<br>&quot;&quot;&quot;<br><br>import requests<br>import json<br>from typing import Dict, Any, List<br><br># =============================================================================<br># Setup and Configuration<br># =============================================================================<br><br>print(&quot;=== Setup and Configuration ===&quot;)<br><br># Configuration - Update these with your actual values<br>WORKSPACE_URL = &quot;https://&lt;WORKSPACE-URL&gt;.cloud.databricks.com&quot;  # Replace with your workspace URL<br>TOKEN = &quot;&lt;TOEKEN&gt;&quot;  # Replace with your token<br><br># API endpoints<br>EXTERNAL_METADATA_ENDPOINT = f&quot;{WORKSPACE_URL}/api/2.0/lineage-tracking/external-metadata&quot;<br>EXTERNAL_LINEAGE_ENDPOINT = f&quot;{WORKSPACE_URL}/api/2.0/lineage-tracking/external-lineage&quot;<br><br># Headers for API requests<br>headers = {<br>    &quot;Authorization&quot;: f&quot;Bearer {TOKEN}&quot;,<br>    &quot;Content-Type&quot;: &quot;application/json&quot;<br>}<br><br>print(&quot; Configuration set up&quot;)<br>print(f&quot;Workspace URL: {WORKSPACE_URL}&quot;)<br>print(f&quot;External Metadata Endpoint: {EXTERNAL_METADATA_ENDPOINT}&quot;)<br>print(f&quot;External Lineage Endpoint: {EXTERNAL_LINEAGE_ENDPOINT}&quot;)</pre><h3>Simple Examples</h3><p>Let’s start with a simple example. Create two external objects and then create lineage between them. First, we’ll create a PostgreSQL table object.</p><pre># =============================================================================<br># Simple Example - Create Two Objects and Lineage Between Them<br># =============================================================================<br><br>print(&quot;\n=== Simple Example - Two Objects and Lineage ===&quot;)<br><br># Create a PostgreSQL table object<br>postgres_table = {<br>    &quot;name&quot;: &quot;customer_data&quot;,<br>    &quot;entity_type&quot;: &quot;Table&quot;,<br>    &quot;system_type&quot;: &quot;POSTGRESQL&quot;,<br>    &quot;description&quot;: &quot;Customer data table in PostgreSQL database&quot;,<br>    &quot;url&quot;: &quot;https://postgres.company.com/db/customers&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;name&quot;, &quot;email&quot;, &quot;created_date&quot;],<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;sales_db&quot;,<br>        &quot;schema&quot;: &quot;public&quot;,<br>        &quot;table&quot;: &quot;customers&quot;<br>    }<br>}<br><br>print(&quot; Creating PostgreSQL table object...&quot;)<br>response = requests.post(EXTERNAL_METADATA_ENDPOINT, headers=headers, json=postgres_table)<br>if response.status_code == 200:<br>    postgres_table_id = response.json()[&quot;id&quot;]<br>    print(f&quot; PostgreSQL table created with ID: {postgres_table_id}&quot;)<br>else:<br>    print(f&quot; Failed to create PostgreSQL table: {response.text}&quot;)</pre><p>Create File Object</p><pre># Create a file object<br>output_file = {<br>    &quot;name&quot;: &quot;customer_report&quot;,<br>    &quot;entity_type&quot;: &quot;File&quot;,<br>    &quot;system_type&quot;: &quot;OTHER&quot;,<br>    &quot;description&quot;: &quot;Customer data exported to CSV file&quot;,<br>    &quot;url&quot;: &quot;https://storage.company.com/reports/customer_report.csv&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;name&quot;, &quot;email&quot;, &quot;created_date&quot;],<br>    &quot;properties&quot;: {<br>        &quot;file_format&quot;: &quot;CSV&quot;,<br>        &quot;file_size&quot;: &quot;2.5MB&quot;,<br>        &quot;location&quot;: &quot;/reports/customer_report.csv&quot;<br>    }<br>}<br><br>print(&quot;\n📝 Creating file object...&quot;)<br>response = requests.post(EXTERNAL_METADATA_ENDPOINT, headers=headers, json=output_file)<br>if response.status_code == 200:<br>    file_id = response.json()[&quot;id&quot;]<br>    print(f&quot; File object created with ID: {file_id}&quot;)<br>else:<br>    print(f&quot; Failed to create file object: {response.text}&quot;)</pre><p>Finally, let’s create the lineage between them.</p><pre># Create lineage between PostgreSQL table and file<br>if &#39;postgres_table_id&#39; in locals() and &#39;file_id&#39; in locals():<br>    lineage = {<br>        &quot;source&quot;: {<br>            &quot;external_metadata&quot;: {<br>                &quot;name&quot;: &quot;customer_data&quot;<br>            }<br>        },<br>        &quot;target&quot;: {<br>            &quot;external_metadata&quot;: {<br>                &quot;name&quot;: &quot;customer_report&quot;<br>            }<br>        },<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;name&quot;, &quot;target&quot;: &quot;name&quot;},<br>            {&quot;source&quot;: &quot;email&quot;, &quot;target&quot;: &quot;email&quot;},<br>            {&quot;source&quot;: &quot;created_date&quot;, &quot;target&quot;: &quot;created_date&quot;}<br>        ],<br>        &quot;properties&quot;: {<br>            &quot;transformation_type&quot;: &quot;export&quot;,<br>            &quot;frequency&quot;: &quot;daily&quot;<br>        }<br>    }<br><br>    print(&quot;\n Creating lineage relationship...&quot;)<br>    response = requests.post(EXTERNAL_LINEAGE_ENDPOINT, headers=headers, json=lineage)<br>    if response.status_code == 200:<br>        lineage_id = response.json()[&quot;id&quot;]<br>        print(f&quot; Lineage created with ID: {lineage_id}&quot;)<br>    else:<br>        print(f&quot; Failed to create lineage: {response.text}&quot;)</pre><p>Once you’ve run the code, you can find the created objects in the Databricks UI under Catalog Explorer -&gt; External Location -&gt; External Metadata. From there, you can click on an object like customer_report to see its details and view the lineage graph by clicking the &quot;See lineage graph&quot; button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tm4qqHTuaZLfEMR8QSzsPA.png" /><figcaption>Two External Objects</figcaption></figure><p>Now Click on any one of these -&gt; customer_report</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLCc-sfBswd9zpdWlh3KDw.png" /><figcaption>customer_report</figcaption></figure><p>Now click on the Lineage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W74oa_X4c354RmS0K15jTA.png" /></figure><p>And finally on [See lineage graph] button on right top side, just below the blue button you see in above picture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8mlp83SJKaiVi--7loD3Q.png" /></figure><h3>Complex Example</h3><p>Let’s create a more complex example for external objects and lineage: Postgres -&gt; Snowflake -&gt; PowerBI -&gt; API.</p><pre># =============================================================================<br># Complex Example 1 - Postgres -&gt; Snowflake -&gt; PowerBI -&gt; API<br># =============================================================================<br><br>print(&quot;\n=== Complex Example 1 - Multi-System Lineage ===&quot;)<br><br># 1. PostgreSQL Database<br>postgres_db = {<br>    &quot;name&quot;: &quot;sales_database&quot;,<br>    &quot;entity_type&quot;: &quot;Database&quot;,<br>    &quot;system_type&quot;: &quot;POSTGRESQL&quot;,<br>    &quot;description&quot;: &quot;Main sales database in PostgreSQL&quot;,<br>    &quot;url&quot;: &quot;https://postgres.company.com/sales_db&quot;,<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;sales_db&quot;,<br>        &quot;version&quot;: &quot;13.0&quot;<br>    }<br>}<br><br># 2. PostgreSQL Table<br>postgres_customers_table = {<br>    &quot;name&quot;: &quot;customers&quot;,<br>    &quot;entity_type&quot;: &quot;Table&quot;,<br>    &quot;system_type&quot;: &quot;POSTGRESQL&quot;,<br>    &quot;description&quot;: &quot;Customer information table&quot;,<br>    &quot;url&quot;: &quot;https://postgres.company.com/sales_db/customers&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;first_name&quot;, &quot;last_name&quot;, &quot;email&quot;, &quot;phone&quot;, &quot;address&quot;],<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;sales_db&quot;,<br>        &quot;schema&quot;: &quot;public&quot;,<br>        &quot;table&quot;: &quot;customers&quot;<br>    }<br>}<br><br># 3. Snowflake Table<br>snowflake_table = {<br>    &quot;name&quot;: &quot;customer_analytics&quot;,<br>    &quot;entity_type&quot;: &quot;Table&quot;,<br>    &quot;system_type&quot;: &quot;SNOWFLAKE&quot;,<br>    &quot;description&quot;: &quot;Customer analytics table in Snowflake&quot;,<br>    &quot;url&quot;: &quot;https://company.snowflake.com/db/analytics/customer_analytics&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;full_name&quot;, &quot;email&quot;, &quot;customer_segment&quot;, &quot;total_orders&quot;],<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;analytics_db&quot;,<br>        &quot;schema&quot;: &quot;customer_schema&quot;,<br>        &quot;warehouse&quot;: &quot;analytics_wh&quot;<br>    }<br>}<br><br># 4. PowerBI Dashboard<br>powerbi_dashboard = {<br>    &quot;name&quot;: &quot;customer_insights_dashboard&quot;,<br>    &quot;entity_type&quot;: &quot;Dashboard&quot;,<br>    &quot;system_type&quot;: &quot;POWER_BI&quot;,<br>    &quot;description&quot;: &quot;Customer insights and analytics dashboard&quot;,<br>    &quot;url&quot;: &quot;https://app.powerbi.com/dashboards/customer-insights&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;customer_name&quot;, &quot;segment&quot;, &quot;order_count&quot;, &quot;revenue&quot;],<br>    &quot;properties&quot;: {<br>        &quot;workspace&quot;: &quot;Sales Analytics&quot;,<br>        &quot;refresh_frequency&quot;: &quot;daily&quot;<br>    }<br>}<br><br># 5. API Endpoint<br>api_endpoint = {<br>    &quot;name&quot;: &quot;customer_api&quot;,<br>    &quot;entity_type&quot;: &quot;API&quot;,<br>    &quot;system_type&quot;: &quot;OTHER&quot;,<br>    &quot;description&quot;: &quot;Customer data API endpoint&quot;,<br>    &quot;url&quot;: &quot;https://api.company.com/v1/customers&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;name&quot;, &quot;email&quot;, &quot;segment&quot;],<br>    &quot;properties&quot;: {<br>        &quot;api_version&quot;: &quot;v1&quot;,<br>        &quot;endpoint&quot;: &quot;/customers&quot;,<br>        &quot;method&quot;: &quot;GET&quot;<br>    }<br>}<br><br># Create all objects<br>objects_to_create = [<br>    (&quot;PostgreSQL Database&quot;, postgres_db),<br>    (&quot;PostgreSQL Table&quot;, postgres_customers_table),<br>    (&quot;Snowflake Table&quot;, snowflake_table),<br>    (&quot;PowerBI Dashboard&quot;, powerbi_dashboard),<br>    (&quot;API Endpoint&quot;, api_endpoint)<br>]<br><br>created_objects = {}<br><br>for obj_name, obj_data in objects_to_create:<br>    print(f&quot; Creating {obj_name}...&quot;)<br>    response = requests.post(EXTERNAL_METADATA_ENDPOINT, headers=headers, json=obj_data)<br>    if response.status_code == 200:<br>        obj_id = response.json()[&quot;id&quot;]<br>        created_objects[obj_name] = obj_id<br>        print(f&quot; {obj_name} created with ID: {obj_id}&quot;)<br>    else:<br>        print(f&quot; Failed to create {obj_name}: {response.text}&quot;)<br><br># Create lineage relationships<br>lineages_to_create = [<br>    {<br>        &quot;name&quot;: &quot;PostgreSQL DB -&gt; PostgreSQL Table&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_database&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customers&quot;}},<br>        &quot;properties&quot;: {&quot;relationship_type&quot;: &quot;contains&quot;}<br>    },<br>    {<br>        &quot;name&quot;: &quot;PostgreSQL Table -&gt; Snowflake Table&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customers&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customer_analytics&quot;}},<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;first_name&quot;, &quot;target&quot;: &quot;full_name&quot;},<br>            {&quot;source&quot;: &quot;email&quot;, &quot;target&quot;: &quot;email&quot;}<br>        ],<br>        &quot;properties&quot;: {&quot;transformation_type&quot;: &quot;ETL&quot;, &quot;frequency&quot;: &quot;hourly&quot;}<br>    },<br>    {<br>        &quot;name&quot;: &quot;Snowflake Table -&gt; PowerBI Dashboard&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customer_analytics&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customer_insights_dashboard&quot;}},<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;full_name&quot;, &quot;target&quot;: &quot;customer_name&quot;},<br>            {&quot;source&quot;: &quot;customer_segment&quot;, &quot;target&quot;: &quot;segment&quot;}<br>        ],<br>        &quot;properties&quot;: {&quot;visualization_type&quot;: &quot;dashboard&quot;, &quot;refresh_frequency&quot;: &quot;daily&quot;}<br>    },<br>    {<br>        &quot;name&quot;: &quot;Snowflake Table -&gt; API&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customer_analytics&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;customer_api&quot;}},<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;full_name&quot;, &quot;target&quot;: &quot;name&quot;},<br>            {&quot;source&quot;: &quot;email&quot;, &quot;target&quot;: &quot;email&quot;},<br>            {&quot;source&quot;: &quot;customer_segment&quot;, &quot;target&quot;: &quot;segment&quot;}<br>        ],<br>        &quot;properties&quot;: {&quot;api_type&quot;: &quot;rest&quot;, &quot;caching&quot;: &quot;enabled&quot;}<br>    }<br>]<br><br>print(&quot;\n Creating lineage relationships...&quot;)<br>for lineage_data in lineages_to_create:<br>    lineage_name = lineage_data.pop(&quot;name&quot;)<br>    print(f&quot; Creating {lineage_name}...&quot;)<br>    response = requests.post(EXTERNAL_LINEAGE_ENDPOINT, headers=headers, json=lineage_data)<br>    if response.status_code == 200:<br>        lineage_id = response.json()[&quot;id&quot;]<br>        print(f&quot; {lineage_name} created with ID: {lineage_id}&quot;)<br>    else:<br>        print(f&quot; Failed to create {lineage_name}: {response.text}&quot;)</pre><p>This is how it will look (follow same steps like I explained earlier to get to this)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOlRXgi9GuIjO-1GnbjwQg.png" /><figcaption>All the external objects created</figcaption></figure><p>Click on any customer* object — I clicked customers table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2H_8jrQ4cFaAJIaLdpBYZg.png" /><figcaption>Unexpanded Lineage</figcaption></figure><p>Let’s expand this further by clicking the (+) buttons</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akicDDNdNnw8xkvJkVMHPg.png" /><figcaption>Fully expended lineage</figcaption></figure><p>Here’s one more example of a pipeline from a file to a database and then to an Excel report.</p><pre># =============================================================================<br># Complex Example 2 - File -&gt; Database -&gt; Table -&gt; File<br># =============================================================================<br><br>print(&quot;\n=== Example 2 - File Processing Pipeline ===&quot;)<br><br># 1. Source CSV File<br>source_file = {<br>    &quot;name&quot;: &quot;raw_sales_data&quot;,<br>    &quot;entity_type&quot;: &quot;File&quot;,<br>    &quot;system_type&quot;: &quot;OTHER&quot;,<br>    &quot;description&quot;: &quot;Raw sales data in CSV format&quot;,<br>    &quot;url&quot;: &quot;https://storage.company.com/raw/sales_data.csv&quot;,<br>    &quot;columns&quot;: [&quot;order_id&quot;, &quot;customer_id&quot;, &quot;product_id&quot;, &quot;quantity&quot;, &quot;price&quot;, &quot;date&quot;],<br>    &quot;properties&quot;: {<br>        &quot;file_format&quot;: &quot;CSV&quot;,<br>        &quot;file_size&quot;: &quot;50MB&quot;,<br>        &quot;encoding&quot;: &quot;UTF-8&quot;<br>    }<br>}<br><br># 2. MySQL Database<br>mysql_db = {<br>    &quot;name&quot;: &quot;sales_warehouse&quot;,<br>    &quot;entity_type&quot;: &quot;Database&quot;,<br>    &quot;system_type&quot;: &quot;MYSQL&quot;,<br>    &quot;description&quot;: &quot;Sales data warehouse in MySQL&quot;,<br>    &quot;url&quot;: &quot;https://mysql.company.com/sales_warehouse&quot;,<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;sales_warehouse&quot;,<br>        &quot;version&quot;: &quot;8.0&quot;<br>    }<br>}<br><br># 3. MySQL Table<br>mysql_sales_table = {<br>    &quot;name&quot;: &quot;sales_transactions&quot;,<br>    &quot;entity_type&quot;: &quot;Table&quot;,<br>    &quot;system_type&quot;: &quot;MYSQL&quot;,<br>    &quot;description&quot;: &quot;Processed sales transactions table&quot;,<br>    &quot;url&quot;: &quot;https://mysql.company.com/sales_warehouse/sales_transactions&quot;,<br>    &quot;columns&quot;: [&quot;order_id&quot;, &quot;customer_id&quot;, &quot;product_id&quot;, &quot;quantity&quot;, &quot;unit_price&quot;, &quot;total_amount&quot;, &quot;transaction_date&quot;],<br>    &quot;properties&quot;: {<br>        &quot;database&quot;: &quot;sales_warehouse&quot;,<br>        &quot;table&quot;: &quot;sales_transactions&quot;,<br>        &quot;indexes&quot;: &quot;order_id, customer_id&quot;<br>    }<br>}<br><br># 4. Output Report File<br>output_report = {<br>    &quot;name&quot;: &quot;sales_summary_report&quot;,<br>    &quot;entity_type&quot;: &quot;File&quot;,<br>    &quot;system_type&quot;: &quot;OTHER&quot;,<br>    &quot;description&quot;: &quot;Sales summary report in Excel format&quot;,<br>    &quot;url&quot;: &quot;https://storage.company.com/reports/sales_summary.xlsx&quot;,<br>    &quot;columns&quot;: [&quot;customer_id&quot;, &quot;total_orders&quot;, &quot;total_revenue&quot;, &quot;avg_order_value&quot;],<br>    &quot;properties&quot;: {<br>        &quot;file_format&quot;: &quot;XLSX&quot;,<br>        &quot;file_size&quot;: &quot;2MB&quot;,<br>        &quot;generated_by&quot;: &quot;BI Tool&quot;<br>    }<br>}<br><br># Create objects<br>file_pipeline_objects = [<br>    (&quot;Source CSV File&quot;, source_file),<br>    (&quot;MySQL Database&quot;, mysql_db),<br>    (&quot;MySQL Table&quot;, mysql_sales_table),<br>    (&quot;Output Report File&quot;, output_report)<br>]<br><br>file_pipeline_created = {}<br><br>for obj_name, obj_data in file_pipeline_objects:<br>    print(f&quot; Creating {obj_name}...&quot;)<br>    response = requests.post(EXTERNAL_METADATA_ENDPOINT, headers=headers, json=obj_data)<br>    if response.status_code == 200:<br>        obj_id = response.json()[&quot;id&quot;]<br>        file_pipeline_created[obj_name] = obj_id<br>        print(f&quot; {obj_name} created with ID: {obj_id}&quot;)<br>    else:<br>        print(f&quot; Failed to create {obj_name}: {response.text}&quot;)<br><br># Create lineage relationships for file pipeline<br>file_lineages = [<br>    {<br>        &quot;name&quot;: &quot;CSV File -&gt; MySQL Database&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;raw_sales_data&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_warehouse&quot;}},<br>        &quot;properties&quot;: {&quot;ingestion_type&quot;: &quot;bulk_load&quot;, &quot;frequency&quot;: &quot;daily&quot;}<br>    },<br>    {<br>        &quot;name&quot;: &quot;MySQL Database -&gt; MySQL Table&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_warehouse&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_transactions&quot;}},<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;order_id&quot;, &quot;target&quot;: &quot;order_id&quot;},<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;product_id&quot;, &quot;target&quot;: &quot;product_id&quot;},<br>            {&quot;source&quot;: &quot;quantity&quot;, &quot;target&quot;: &quot;quantity&quot;},<br>            {&quot;source&quot;: &quot;price&quot;, &quot;target&quot;: &quot;unit_price&quot;}<br>        ],<br>        &quot;properties&quot;: {&quot;transformation_type&quot;: &quot;data_processing&quot;, &quot;frequency&quot;: &quot;daily&quot;}<br>    },<br>    {<br>        &quot;name&quot;: &quot;MySQL Table -&gt; Excel Report&quot;,<br>        &quot;source&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_transactions&quot;}},<br>        &quot;target&quot;: {&quot;external_metadata&quot;: {&quot;name&quot;: &quot;sales_summary_report&quot;}},<br>        &quot;columns&quot;: [<br>            {&quot;source&quot;: &quot;customer_id&quot;, &quot;target&quot;: &quot;customer_id&quot;},<br>            {&quot;source&quot;: &quot;order_id&quot;, &quot;target&quot;: &quot;total_orders&quot;},<br>            {&quot;source&quot;: &quot;total_amount&quot;, &quot;target&quot;: &quot;total_revenue&quot;}<br>        ],<br>        &quot;properties&quot;: {&quot;report_type&quot;: &quot;summary&quot;, &quot;generation_frequency&quot;: &quot;weekly&quot;}<br>    }<br>]<br><br>print(&quot;\n Creating file pipeline lineage relationships...&quot;)<br>for lineage_data in file_lineages:<br>    lineage_name = lineage_data.pop(&quot;name&quot;)<br>    print(f&quot; Creating {lineage_name}...&quot;)<br>    response = requests.post(EXTERNAL_LINEAGE_ENDPOINT, headers=headers, json=lineage_data)<br>    if response.status_code == 200:<br>        lineage_id = response.json()[&quot;id&quot;]<br>        print(f&quot; {lineage_name} created with ID: {lineage_id}&quot;)<br>    else:<br>        print(f&quot; Failed to create {lineage_name}: {response.text}&quot;)<br><br></pre><p>This is how it will appear in UI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pi0epbDUUnlTtbErdN1-iQ.png" /><figcaption>Fully expended</figcaption></figure><p>Let’s clean up</p><pre># =============================================================================<br># Cleanup Example (Optional)<br># =============================================================================<br><br>print(&quot;\n=== Cleanup Example (Optional) ===&quot;)<br><br># Note: This is optional and will delete the objects we created<br># Uncomment the code below if you want to clean up<br><br># List all objects for cleanup<br>response = requests.get(EXTERNAL_METADATA_ENDPOINT, headers=headers)<br>if response.status_code == 200:<br>    objects = response.json().get(&quot;external_metadata&quot;, [])<br>    print(f&quot;Found {len(objects)} objects to potentially delete&quot;)<br>    # Delete objects (be careful with this!)<br>    for obj in objects:<br>        obj_id = obj[&quot;id&quot;]<br>        obj_name = obj[&quot;name&quot;]<br>        print(f&quot; Deleting {obj_name}:{obj_id}&quot;)<br>        delete_response = requests.delete(f&quot;{EXTERNAL_METADATA_ENDPOINT}/{obj_name}&quot;, headers=headers)<br>        if delete_response.status_code == 200:<br>            print(f&quot; Deleted {obj_name}&quot;)<br>        else:<br>            print(f&quot; Failed to delete {obj_name}: {delete_response.text}&quot;)<br><br>print(&quot; Demo completed! All examples have been executed.&quot;)<br>print(&quot;\n Summary of what was created:&quot;)<br>print(&quot;- Simple example: PostgreSQL table -&gt; CSV file&quot;)<br>print(&quot;- Complex example 1: Postgres DB -&gt; Table -&gt; Snowflake -&gt; PowerBI + API&quot;)<br>print(&quot;- Complex example 2: CSV File -&gt; MySQL DB -&gt; Table -&gt; Excel Report&quot;)<br>print(&quot;- List and query examples for different filters&quot;)</pre><h3>Conclusion</h3><p>This is a really helpful and super easy to use feature which can add tremendous value to your data lineage and quality. It will help build trust in your data and significantly reduce the time it takes to do impact analysis. My recommendation would be to automate it using metadata, either as a part of your existing data pipelines or as a separate, dedicated process.</p><h3>References</h3><ul><li><a href="https://docs.databricks.com/aws/en/data-governance/unity-catalog/external-lineage">Documentation about Bring Your Data Lineage</a></li><li><a href="https://docs.databricks.com/api/workspace/externalmetadata">External Metadata API</a></li><li><a href="https://docs.databricks.com/api/workspace/externallineage">External Lineage API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb57ff276f20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Databricks Unity Catalog Volumes]]></title>
            <link>https://medium.com/@smanocha/databricks-unity-catalog-volumes-ca218338f63c?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca218338f63c</guid>
            <category><![CDATA[unity-catalog]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Wed, 27 Aug 2025 04:44:17 GMT</pubDate>
            <atom:updated>2025-08-27T04:53:27.821Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog serves as a concise guide to Databricks Unity Catalog volumes, outlining their purpose, functionality, and recommended management practices. For comprehensive details, please refer to the online documentation.</p><h3>What are Volumes? 📁</h3><p>Unity Catalog volumes are governed objects within Databricks designed for managing non-tabular data in the cloud. They are distinct from tables, which are used for structured data, and serve as a centralized, secure way to handle files like images, audio, video, and general documents.</p><p><strong>There are two types of volumes:</strong></p><p><strong>Managed Volumes</strong>: This is the recommended and default type. Databricks manages the underlying storage, file lifecycle, and data layout. When a managed volume is dropped, its files are marked for deletion after 7 days. Files within managed volumes will reside in a sub-directory of the designated Managed Location.</p><blockquote><strong>Example</strong>: Your data science team needs a place to store image files for a computer vision project. You create a <strong>managed volume</strong> named image_data within your <strong>data_science</strong> <strong>schema</strong>. The files are stored in a Databricks-managed location, and the team can access them using the path /Volumes/your_catalog/data_science/image_data/.</blockquote><p><strong>External Volumes</strong>: These allow you to apply Unity Catalog governance to an existing directory in your cloud storage. They are useful for data that needs to be accessed by external systems or when you don’t want to migrate existing data. Dropping an external volume does not affect the files in the cloud storage.</p><blockquote><strong>Example</strong>: Your company has an <strong>existing</strong> S3 bucket with <strong>raw CSV files </strong>from a third-party vendor. You don’t want to move these files, but you need to <strong>manage access to them in Databricks</strong>. You create an <strong>external volume</strong> named <strong>raw_vendor_data</strong> in <strong>your_catalog</strong> under <strong>vendor-files</strong> <strong>schema</strong> that points to the s3://my-company-data/vendor-files/ path. Now, your data engineers can access these files via /Volumes/your_catalog/vendor-files/ with the right permissions, without needing direct S3 access credentials.</blockquote><p><strong>Visual Aid &amp; Steps for External Volumes</strong></p><ol><li><strong>Set up an S3 Folder in AWS:</strong></li></ol><p>Create a dedicated S3 folder for your external volume.</p><blockquote><em>Example:</em> s3://demonhid15-rootbucket-sm/external_vol/</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/0*vUlCdgjX93gNPgMK" /></figure><p><strong>2. Establish an External Location in Unity Catalog:</strong></p><p>Within the Unity Catalog, create an external location that points to your S3 folder. This acts as the bridge between Unity Catalog and your external storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*JHT1EwYH2X4LAR59" /></figure><p><strong>3. Create an External Volume:</strong></p><p>Using the external location you just created, define an external volume (e.g., external_vol). This logical volume in Unity Catalog represents your S3 folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*PcmCkCzTXGFbFtTe" /></figure><p><strong>4. Upload and Verify Files:</strong></p><p>Upload files to your newly created external volume via the Unity Catalog UI.</p><p>Confirm that these files are also reflected in your underlying S3 bucket, ensuring proper synchronization.</p><p>Confirm that these files are also reflected in your underlying S3 bucket, ensuring proper synchronization.</p><p><strong>5. File Deletion and Synchronization:</strong></p><ul><li>When you delete a file from the external volume within the Unity Catalog UI, it will also be automatically deleted from the associated S3 bucket.</li></ul><p><strong>6. Volume Deletion and Storage Persistence:</strong></p><ul><li>If you delete the external volume from the Unity Catalog UI, the volume itself is removed from Unity Catalog.</li><li>However, the underlying storage in the S3 bucket, including any files and folders, remains intact. This means your data is not lost even if the volume is no longer managed by Unity Catalog.</li></ul><p><strong>Key Benefit:</strong></p><ul><li>By creating an external volume on an existing S3 bucket/folder, any files previously stored in that S3 location automatically become visible and manageable within the Unity Catalog UI. This seamless integration simplifies data access and governance.</li></ul><h3>External Locations vs. Volumes ↔️</h3><p>This is a key distinction that can be confusing. Think of it this way:</p><ul><li>External Locations are the “disk” or “root” of your cloud storage. You use them primarily for a single purpose: to register other governed objects like external volumes, tables, and managed storage for catalogs/schemas. They are a one-time setup for access.</li><li>Volumes are the “file systems” or “folders” on that disk. They are the actual objects you use for everyday work with non-tabular data. You should use volumes for data science tasks, ETL ingestion points, and general file storage, not external locations directly.</li></ul><p>Granting permissions on an external location gives broad access to create governed objects, while granting permissions on a volume gives specific access to the files within that volume.</p><p><strong>Use external locations to</strong>:</p><h4>Registering External Tables and Volumes</h4><p>To connect to your data in the cloud, you’ll need to register it. You can do this with the <strong>CREATE EXTERNAL VOLUME</strong> or <strong>CREATE TABLE</strong> commands. These commands essentially tell your system where to find and access your data without moving it.</p><h4>Exploring Your Files</h4><p>Before you register a table or volume, it’s a good idea to know what’s there. You can explore existing files in your cloud storage to find the specific folder or <strong>prefix</strong> you want to use. Just make sure you have the <strong>READ FILES</strong> privilege first — it’s a necessary step to look at your data before you connect to it.</p><h4>Using Managed Storage</h4><p>Instead of using your metastore’s default storage, you can register a specific location to serve as a <strong>managed storage</strong> for your catalogs and schemas. This gives you more control over your data organization. The only requirement is that you have the <strong>CREATE MANAGED STORAGE</strong> privilege.</p><h3>Permissions and Key Concepts 🔑</h3><ul><li>Paths: Files are accessed using a three-level namespace: catalog.schema.volume. For example, /Volumes/my_catalog/my_schema/my_volume/file.txt.</li><li>Permissions: The lowest level of access control is the volume itself. Privileges like READ VOLUME and WRITE VOLUME apply to the entire volume, not to individual subdirectories. The specific permissions required for various operations are:</li><li>CREATE VOLUME: Allows a user to create a new volume.</li><li>CREATE EXTERNAL VOLUME: Allows a user to create an external volume on an existing external location.</li><li>READ VOLUME: Grants read access to all files and subdirectories within a volume.</li><li>WRITE VOLUME: Grants write access to a volume.</li><li>MANAGE: Allows a user to manage a volume’s permissions, drop, or rename it.</li><li>Ownership: Volumes have a single owner, typically a group, to ensure consistent management. The owner and users with the MANAGE privilege can manage volume permissions.</li></ul><h3>General Best Practices ✨</h3><ol><li><strong>Use Volumes for All Non-Tabular Data</strong>: Avoid using general path-based access (READ FILES on external locations) for non-tabular data science or ETL tasks. Volumes provide a more secure and user-friendly method for this purpose.</li><li><strong>Ensure Granular Permissions with Separate Volumes</strong>: If different subdirectories require different levels of access, you must create a separate volume for each. A single volume’s permissions cannot be applied at a subdirectory level.</li><li><strong>Choose the Right Volume Type</strong>: Use managed volumes for new data or for a simpler setup. Use external volumes for governing existing data in a cloud location that you don’t want to move or that needs external access.</li><li><strong>Assign Ownership to a Group</strong>: Assign volume ownership to a group instead of an individual to prevent issues with employee turnover and to ensure long-term stability.</li><li><strong>Delegate with the MANAGE Privilege</strong>: Granting the MANAGE privilege allows other users or groups to administer a volume’s permissions without having to be the owner.</li><li><strong>Avoid Path Overlaps</strong>: Do not create external volumes or tables at the root of an external location. This can prevent you from creating further governed objects in the same location and is considered a poor practice.</li><li><strong>Do Not Reuse DBFS Buckets</strong>: Never use your DBFS bucket for Unity Catalog storage, as this can allow users to circumvent Unity Catalog’s Access Control Lists (ACLs).</li></ol><h3>References 📚</h3><ul><li><a href="https://docs.databricks.com/aws/en/volumes/">Databricks Official Documentation: Volumes</a></li><li><a href="https://docs.databricks.com/aws/en/volumes/managed-vs-external">Databricks Official Documentation: Managed vs. External Volumes</a></li><li><a href="https://docs.databricks.com/aws/en/volumes/utility-commands">Databricks Official Documentation: Volume Utility Commands</a></li><li><a href="https://docs.databricks.com/aws/en/files/volumes">Databricks Official Documentation: Working with Files in Volumes</a></li><li><a href="https://docs.databricks.com/aws/en/volumes/privileges">Databricks Official Documentation: Volume Privileges</a></li><li><a href="https://docs.databricks.com/aws/en/volumes/paths">Databricks Official Documentation: Volume Paths</a></li><li><a href="https://www.google.com/search?q=https://go/uc/best-practices">Databricks Best Practices with Unity Catalog</a></li><li>Some other sparse readings and conversations with other SMEs</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca218338f63c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 7 — Business Value Discovery 2: Time, Money, and People]]></title>
            <link>https://medium.com/@smanocha/chapter-7-business-value-discovery-2-time-money-and-people-74b6a47d3bee?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/74b6a47d3bee</guid>
            <category><![CDATA[professional-services]]></category>
            <category><![CDATA[architects]]></category>
            <category><![CDATA[solution-architect]]></category>
            <category><![CDATA[data-architect]]></category>
            <category><![CDATA[sales-engineering]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 17:26:28 GMT</pubDate>
            <atom:updated>2025-07-28T17:26:28.635Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 7 — Business Value Discovery 2: Time, Money, and People</h3><h3>Beyond the “What”: Diving Deeper into “Why”</h3><p>Hey everyone! If you’ve been following along with my journey through “Mastering Technical Sales — The Sales Engineer’s Handbook,” you’ll know that in Chapter 6, we talked about the critical first step: <a href="https://medium.com/@smanocha/mastering-technical-sales-the-sales-engineers-handbook-chapter-6-fe5be1a523cf"><strong>Business Value Discovery 1: Pains and Gains</strong></a>. I learned to identify customer issues and categorize them — whether they were latent, current, or vision pains. It was all about getting a high-level understanding of what was bothering our customers.</p><p>Now, in Chapter 7, “Business Value Discovery 2: Time, Money, and People,” the book takes us to the next crucial stage. Once we have that prioritized list of issues, it’s time to roll up our sleeves and really <strong>dig into the “why”</strong>: Why would a customer invest their time and money to fix <em>these specific problems</em>?</p><h3>Focusing Your Energy: The Power of Prioritization</h3><p>After our initial discovery, we often have a list of challenges. But as the book points out, and as I’ve learned through experience, you can’t tackle everything at once. I personally lean on the <strong>80–20 rule</strong> — focusing on the 20% of issues that will deliver 80% of the impact. The book reinforces this by suggesting we concentrate on the <strong>top three priorities</strong>. By now, we should have a clear picture of why these specific issues are the most critical.</p><p>It’s not enough to just list problems; we need to understand their <strong>impact and magnitude</strong>. What will the customer truly <em>gain</em> once these issues are resolved? We can’t just take their word for it. We need to explore these gains through thoughtful questions and conversations.</p><h3>Asking the Right Questions, the Right Way</h3><p>This chapter provides an excellent framework for asking questions, which is something I’ve continually refined in my own career.</p><p><strong>Closed-Ended Questions:</strong> The book advises using these sparingly, and I agree. While they can feel like an interrogation if overused, I find them incredibly useful for <strong>clarifying scope and setting clear expectations</strong>. They’re great for confirming a specific detail or bringing a point to a clear “yes” or “no.”</p><p><strong>Open-Ended Questions:</strong> These are your conversation starters, helping you keep the dialogue flowing. The book suggests the classic <strong>5W + H (Who, What, When, Where, How)</strong>, but cautions against using “<strong>why</strong>” too much, as it can sound accusatory. My personal take on these questions involves a slightly different focus:</p><ul><li><strong>Who:</strong> Who are the key players involved? This means everyone — customers, partners, and even my internal account teams. Understanding the stakeholders is crucial.</li><li><strong>What:</strong> What exactly are we solving? Is it about scaling, entering new markets, compliance, disaster recovery, reducing costs, or accelerating innovation? Getting specific here is key.</li><li><strong>When:</strong> What’s the timeline? When does the customer need this solved? This helps us understand urgency, feasibility, and how to best align our resources.</li><li><strong>Where:</strong> Where in their system or process is the challenge manifesting? While “What” often gives us clues, “Where” helps us pinpoint the exact location. In cloud solutions, for example, “where” can involve crucial decisions about regions based on service availability, compliance (like GDPR), or cost considerations.</li><li><strong>How:</strong> As a Solution Architect, my role is often to figure out “how” the problem will be solved technically. But in the discovery phase, “how” can also mean understanding <strong>how the customer <em>feels</em> about solving it</strong> and gaining their buy-in. Sometimes our proposed solutions validate their existing thoughts, and other times we introduce new approaches that are faster, cheaper, and better.</li></ul><h3>The Art of the “Right Amount” of Questions</h3><p>The book suggests asking between 8 and 12 questions, but my experience tells me it’s far more nuanced. The “right amount” is really driven by factors like:</p><ul><li>The <strong>customer’s appetite</strong> for the change/project.</li><li>Their <strong>internal politics and culture</strong> — how open and collaborative are their teams?</li></ul><p>I’ve been in situations where I’ve hosted multi-day in-person workshops with customer teams, and others where getting even an hour for discovery was a challenge. This is where your sales partners are invaluable; they often have the pulse on these dynamics and can help you gauge how much information you can reasonably ask for.</p><p>And sometimes, I’ve learned the hard way, it’s better to <strong>not ask direct questions</strong>. Instead, a more subtle approach works wonders. It’s not about being tricky, but about ensuring you don’t sound too opinionated or demanding. Phrases like, “I understand, tell me more…” or “That’s interesting, I’d love to learn more about that” can keep the conversation flowing naturally without putting anyone on the spot.</p><p>Ultimately, it boils down to <strong>asking the right questions, the right amount of questions, to the right people.</strong></p><h3>Connecting Answers to Tangible Value: The 3WM+M Framework</h3><p>So, you’ve asked all the smart questions and gathered your insights. Now what? This is where the book introduces the <strong>3WM+M framework, </strong><em>three wonderful metrics and missions</em>, which is brilliant for mapping those answers to <strong>Revenue, Cost, Risk, and Mission</strong>.</p><p>From my perspective at Databricks, I see this framework come alive in several ways:</p><ul><li><strong>Cost:</strong> We empower customers to significantly reduce costs. This is done by leveraging more economical cloud storage for massive data volumes, all while maintaining comprehensive analytics and insights through <strong>Lakehouse solutions</strong>.</li><li><strong>Revenue:</strong> Databricks empowers customers to uncover new business opportunities and accelerate their growth. Our platform provides the comprehensive capabilities to <strong>develop, build, deploy, and monitor powerful AI/ML models</strong>, directly contributing to scaling their operations.</li><li><strong>Risk:</strong> We empower customers to reduce data risk through Unity Catalog’s <strong>robust data governance</strong>, which strengthens security and simplifies compliance.</li></ul><h3>The “Mission” Factor: More Than Just Numbers</h3><p>The “Mission” aspect often requires a bit more effort to articulate, as it’s not always tied directly to monetary gains or risks. It’s about the very <strong>core existence and purpose of an organization</strong>.</p><p>I’ll use a personal example here, from my time working with <strong>St. Jude Children’s Research Hospital</strong>. <em>(Disclaimer: Please be advised that the scenario presented is entirely </em><strong><em>hypothetical</em></strong><em> and designed for </em><strong><em>learning purposes</em></strong><em> only. It is based solely on my personal experiences and views, and I have </em><strong><em>no knowledge of any actual or current relationship</em></strong><em> between Databricks and St. Jude.).</em> St. Jude’s mission is clear: “<a href="https://www.stjude.org/about-st-jude/faq/what-is-st-judes-mission-statement.html"><em>The mission of St. Jude Children’s Research Hospital is to advance cures, and means of prevention, for pediatric catastrophic diseases through research and treatment.</em></a>” To achieve this mission, they need to process enormous amounts of data for research, while simultaneously keeping costs to a minimum as a non-profit reliant on grants and donations.</p><p>For an organization like St. Jude, solutions that improve the efficiency of data processing (cost) or accelerate research insights (leading to new cures — mission fulfillment) are incredibly valuable, even if the “revenue” isn’t traditional. It’s about enabling their fundamental purpose.</p><h3>What’s Your Take?</h3><p>This chapter truly solidifies the idea that our role as technical sales professionals goes far beyond just understanding the tech. It’s about becoming a detective, a trusted advisor, and a partner in achieving real business outcomes.</p><p>How do you approach digging deeper into customer pains? What’s your favourite discovery question? I’d love to hear your thoughts in the comments!</p><blockquote><strong>Disclaimer:</strong> All opinions and interpretations expressed in this blog post are my own and based on my personal learning journey and experiences.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74b6a47d3bee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Technical Sales — The Sales Engineer’s Handbook — Chapter 6]]></title>
            <link>https://medium.com/@smanocha/mastering-technical-sales-the-sales-engineers-handbook-chapter-6-fe5be1a523cf?source=rss-29acd73a59e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe5be1a523cf</guid>
            <category><![CDATA[presales]]></category>
            <category><![CDATA[sales-engineer]]></category>
            <category><![CDATA[sales]]></category>
            <category><![CDATA[solutions-engineer]]></category>
            <dc:creator><![CDATA[Sandeep Manocha]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 06:04:25 GMT</pubDate>
            <atom:updated>2025-07-27T08:20:07.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering Technical Sales — The Sales Engineer’s Handbook — Chapter 6 — Pain &amp; Gain</h3><p>Ever felt like you’re just slinging code or demoing features without truly connecting with your customer’s core needs? I’ve been diving into <em>Mastering Technical Sales — The Sales Engineer’s Handbook</em>, and Chapter 6, “Business Value Discovery 1: Pains and Gains,” was a massive eye-opener. It’s all about shifting our focus from <em>what</em> our product does to <em>why</em> it matters to the business.</p><p>Let’s break down some of the key takeaways that are already reshaping how I think about technical sales.</p><h3>It’s Not Just About the Wires and Widgets</h3><p>One of the biggest lessons from this chapter is that <strong>every technical solution needs to be tied back to a business objective.</strong> Think about it: customers aren’t just buying your software; they’re buying a solution to a problem, an improvement to their bottom line, or a path to future growth. If we only present our product as a cool piece of tech, we’re missing the bigger picture — and so are our customers.</p><p>In today’s consumption-based models, this discovery process isn’t a one-and-done deal. It’s a continuous conversation, always evolving as customer needs change.</p><h3>The Three Flavours of Pain</h3><p>The book beautifully categorizes customer “pains,” and understanding these distinctions is crucial for any sales engineer.</p><ul><li><strong>Latent Pain:</strong> This is the pain customers don’t even know they have, or perhaps they’ve just learned to live with it. Think of it like a dull ache that’s always there, but you’ve stopped noticing.</li><li><strong>Current Pain:</strong> This is the pain that’s actively causing headaches right now. It’s costing them money, hindering productivity, or slowing down their operations. This is often what gets a customer looking for solutions.</li><li><strong>Vision Pain:</strong> This is the proactive pain. Customers see potential future challenges — perhaps due to compliance changes, market shifts, or new regulations — and want to address them before they become a full-blown crisis. These are often discussed at the senior management level, which is a great indicator of high-level commitment.</li></ul><p>The art here? Sometimes, it’s about gently nudging a latent pain into a current pain, not by fear-mongering, but by showing the positive impact addressing it could have on their business, customer satisfaction, or efficiency. It’s like saying, “Hey, that persistent cough? It could turn into something bigger, but imagine how much better you’d feel if you tackled it now!”</p><h3>Listen More, Talk Less</h3><p>This might sound obvious, but it’s a golden rule: <strong>Patience and active listening are your superpowers.</strong> Before you jump into a demo or whip out your snazzy presentation, make sure you’ve truly heard the customer. What are their real struggles? What keeps them up at night? The book emphasizes resisting the urge to “solution” too early.</p><p>It also highlights that while 80% of business opportunities arise from current pains, the remaining 20% come from proactive growth initiatives. A good SE will capitalize on the reactive opportunities, but a <em>great</em> SE will also have an ear to the ground for those proactive growth factors. That’s where true differentiation lies!</p><p>This reminds me of a pre-sales situation I once encountered. A customer wanted to move their infrastructure from one cloud to another and was asking for effort and cost estimates. We had some tools to generate those numbers, and frankly, the solution architecture felt like a standard template. My gut told me a direct presentation without more context wasn’t ideal, but sometimes, customers are incredibly reluctant to provide further information. The pressure from sales to just <em>present something</em> to show progress can be immense. It’s a classic dilemma: do you push for more discovery, or do you give them <em>something</em> to keep the momentum going? This chapter really hammers home why pushing for that deeper understanding, even when it’s tough, is crucial.</p><h3>The Pitfalls of “Playing Dumb” (and When to Play Smart)</h3><p>This chapter also touched on some interesting interpersonal dynamics. There’s a fine line between humility and appearing incompetent. While sales folks might strategically “play dumb” to get more information, as an SE, your role is to demonstrate competence. You want to understand, but you don’t want to come across as clueless. Use humility with care.</p><p>And speaking of gathering information, the advice is clear: <strong>Get as much intel as you can from middle management before meeting the higher-ups.</strong> They’re your goldmine for Key Business Issues (KBIs). List them, verify them, prioritize them. Sometimes, you might even be able to suggest additional issues you’ve identified.</p><h3>The First Pain Isn’t Always the Deepest</h3><p>Here’s a crucial takeaway: <strong>The first issue a customer mentions is rarely their number one priority.</strong> It’s like peeling an onion — you need to keep listening and digging to uncover the true core problems. List as many issues as possible before diving deep into any single one.</p><h3>What’s Your Take?</h3><p>What are your thoughts on discovering business value? Have you had experiences where focusing on pains and gains made all the difference? Share your insights in the comments below!</p><blockquote><strong>Disclaimer:</strong> All opinions and interpretations expressed in this blog post are my own and based on my personal learning journey and experiences.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe5be1a523cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>