<?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 Mitul Luhar on Medium]]></title>
        <description><![CDATA[Stories by Mitul Luhar on Medium]]></description>
        <link>https://medium.com/@luhar.mitul?source=rss-91a5fa5935ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cJTYAoAUvNxQCRjlMBXH1A.jpeg</url>
            <title>Stories by Mitul Luhar on Medium</title>
            <link>https://medium.com/@luhar.mitul?source=rss-91a5fa5935ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:26:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@luhar.mitul/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[Before You Blame the Dashboard, Check the CSV]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@luhar.mitul/most-analytics-issues-start-before-the-first-query-d4e9f49aa1d3?source=rss-91a5fa5935ac------2"><img src="https://cdn-images-1.medium.com/max/897/1*V_R9NXDe4tujKXuoTBqwmQ.png" width="897"></a></p><p class="medium-feed-snippet">Almost every analytics issue I&#x2019;ve debugged over the years had the same root cause.</p><p class="medium-feed-link"><a href="https://medium.com/@luhar.mitul/most-analytics-issues-start-before-the-first-query-d4e9f49aa1d3?source=rss-91a5fa5935ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@luhar.mitul/most-analytics-issues-start-before-the-first-query-d4e9f49aa1d3?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4e9f49aa1d3</guid>
            <category><![CDATA[data-reliability]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 17:02:09 GMT</pubDate>
            <atom:updated>2026-01-03T17:23:45.870Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From 10 Minutes to 30 Seconds: How I Slashed BigQuery Costs by 70%]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@luhar.mitul/from-10-minutes-to-30-seconds-how-i-slashed-bigquery-costs-by-70-4522bd41888d?source=rss-91a5fa5935ac------2"><img src="https://cdn-images-1.medium.com/max/873/1*CpN7dBT2wZuo7U52oOQY2A.png" width="873"></a></p><p class="medium-feed-snippet">BigQuery is incredibly powerful&#x200A;&#x2014;&#x200A;but if queries are written without cloud-native thinking, costs can quietly explode.</p><p class="medium-feed-link"><a href="https://medium.com/@luhar.mitul/from-10-minutes-to-30-seconds-how-i-slashed-bigquery-costs-by-70-4522bd41888d?source=rss-91a5fa5935ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@luhar.mitul/from-10-minutes-to-30-seconds-how-i-slashed-bigquery-costs-by-70-4522bd41888d?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/4522bd41888d</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Sat, 27 Dec 2025 08:36:21 GMT</pubDate>
            <atom:updated>2026-01-03T17:28:02.830Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Seamlessly Transfer Data Between PostgreSQL Databases with the dblink Extension]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://towardsdev.com/seamlessly-transfer-data-between-postgresql-databases-with-the-dblink-extension-c747dbbca1e0?source=rss-91a5fa5935ac------2"><img src="https://cdn-images-1.medium.com/max/874/1*if-ERtVASyHKYgLBWOIXXQ.png" width="874"></a></p><p class="medium-feed-snippet">In the world of data engineering, building efficient data pipelines is crucial. Recently, while working on an internal data warehousing&#x2026;</p><p class="medium-feed-link"><a href="https://towardsdev.com/seamlessly-transfer-data-between-postgresql-databases-with-the-dblink-extension-c747dbbca1e0?source=rss-91a5fa5935ac------2">Continue reading on Towards Dev »</a></p></div>]]></description>
            <link>https://towardsdev.com/seamlessly-transfer-data-between-postgresql-databases-with-the-dblink-extension-c747dbbca1e0?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/c747dbbca1e0</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[extension]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 08:09:03 GMT</pubDate>
            <atom:updated>2026-01-03T17:34:13.261Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[15 Incredible Python Scripts to Elevate Your Productivity and Work Smarter]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@luhar.mitul/15-incredible-python-scripts-to-elevate-your-productivity-and-work-smarter-4b0719b082d3?source=rss-91a5fa5935ac------2"><img src="https://cdn-images-1.medium.com/max/1024/1*JJP_5B7Iz6cNMzcAfqxDLQ.jpeg" width="1024"></a></p><p class="medium-feed-snippet">In the fast-paced world we live in, time is more valuable than ever. Python, with its simplicity and versatility, is the ultimate&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@luhar.mitul/15-incredible-python-scripts-to-elevate-your-productivity-and-work-smarter-4b0719b082d3?source=rss-91a5fa5935ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@luhar.mitul/15-incredible-python-scripts-to-elevate-your-productivity-and-work-smarter-4b0719b082d3?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b0719b082d3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Wed, 25 Dec 2024 19:50:59 GMT</pubDate>
            <atom:updated>2024-12-25T22:04:19.799Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How Can One Unleash the Potential of Dynamic SQL in Google BigQuery]]></title>
            <link>https://towardsdev.com/how-can-one-unleash-the-potential-of-dynamic-sql-in-google-bigquery-f1c9dba809b9?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1c9dba809b9</guid>
            <category><![CDATA[dynamic-sql]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Fri, 03 May 2024 22:57:41 GMT</pubDate>
            <atom:updated>2026-01-03T17:39:01.488Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*0Sqkp8DECEvheQUFePNJhA.png" /></figure><p>To unlock the full capabilities of dynamic SQL in Google BigQuery, it’s essential to understand its potential. By harnessing dynamic SQL, you can dynamically generate and execute SQL statements based on changing criteria, providing flexibility and efficiency in querying large datasets.</p><blockquote>Introducing <strong>EXECUTE IMMEDIATE</strong>: This feature enables the execution of dynamic SQL statements within Google BigQuery.</blockquote><p>Syntax:</p><pre>EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; SQL QUERY &quot;&quot;&quot;) /* without parameter */<br><br>EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; SQL QUERY &quot;&quot;&quot;, parameter-1, parameter-2, ...) /* with parameters */</pre><p>Let’s explore couple of examples to grasp the concept.</p><p><strong>Example-1 </strong>This example showcases the utilization of dynamic SQL without any parameters.</p><pre>EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; SELECT &#39;Hello World !!!&#39; as Message &quot;&quot;&quot;);</pre><p>Let’s break down the code:</p><p><strong>EXECUTE IMMEDIATE</strong>: This is a command in SQL that is used to execute a dynamic SQL statement.</p><p><strong>FORMAT(“”” SELECT ‘Hello World !!!’ as Message “””)</strong>: This part constructs a SQL statement dynamically using the FORMAT function. Inside the FORMAT function, there’s a SELECT statement that selects the string ‘Hello World !!!’ and aliases it as ‘Message’.</p><p>So, when this code runs, it dynamically generates and executes a SQL SELECT statement that selects the string ‘Hello World !!!’ and aliases it as ‘Message’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*bjycNWww3Tz5O0kERX862A.png" /><figcaption>Query Output</figcaption></figure><p><strong>Example-2 </strong>This time, we will introduce one parameter.</p><pre>  DECLARE yr INT64;<br>  SET yr = 2024;<br><br>  EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; SELECT %d as CurrentYear &quot;&quot;&quot;, yr)</pre><p>Let’s break down the code step by step:</p><p><strong>DECLARE yr INT64</strong>: This line declares a variable named yr of type INT64.</p><p><strong>SET yr = 2024</strong>: Here, the value 2024 is assigned to the variable yr.</p><p><strong>EXECUTE IMMEDIATE FORMAT(“”” SELECT %d as CurrentYear “””, yr)</strong>: This line dynamically constructs and executes a SQL SELECT statement. The FORMAT function is used to insert the value of the variable yr into the SELECT statement template.</p><p><strong>%d is a placeholder</strong> in the format string that <strong>represents an integer</strong>. So, %d will be replaced with the value of yr in the resulting SELECT statement.</p><p>So, when this code runs, it dynamically generates and executes a SQL SELECT statement that selects the value of the variable yr (which is 2024 in this case) and aliases it as ‘CurrentYear’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*INqb_1RoPuazfFjL7neBOw.png" /><figcaption>Query Output</figcaption></figure><p><strong>Example-3 </strong>This time, we are doubling the fun with two parameters!</p><pre>DECLARE column_name STRING;<br>DECLARE column_value STRING;<br>  <br>SET column_name =&#39;brand_name&#39;;<br>SET column_value =&#39;ABC&#39;;<br><br>EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; SELECT &#39;%s&#39; as %s &quot;&quot;&quot;,column_value,column_name);</pre><p>Let’s break down this code:</p><p><strong>DECLARE column_name STRING and DECLARE column_value STRING</strong>: These lines declare two variables, column_name and column_value, both of which are of type STRING.</p><p><strong>SET column_name =’brand_name’ and SET column_value =’ABC’</strong>: These lines set the values of the variables column_name and column_value to ‘brand_name’ and ‘ABC’, respectively.</p><p><strong>EXECUTE IMMEDIATE FORMAT(“”” SELECT ‘%s’ as %s “””,column_value,column_name)</strong>”: This line executes a dynamic SQL statement.</p><ul><li>FORMAT() is a function used to construct a string with formatted placeholders.</li><li>In this case, it constructs a SQL SELECT statement where<strong> ‘%s’ is a placeholder for a string</strong>.</li><li>The<strong> </strong>%s placeholders are replaced by the values of column_value and column_name respectively.</li><li>So, %s in the first placeholder is replaced by ‘ABC’, and %s in the second placeholder is replaced by ‘brand_name’.</li><li>The resulting SQL SELECT statement selects the value ‘ABC’ and aliases it with the column name ‘brand_name’.</li><li>Be sure to take note of the clever use of %s here — it’s pulling double duty in two unique ways!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*IxennGsaaOgOObRvsqdk5Q.png" /><figcaption>Query Output</figcaption></figure><p><strong>Example-4 </strong>Lastly, let’s delve into a captivating example: generating dynamic columns for a pivot with seven parameters.</p><pre>DECLARE category_1 STRING;<br>DECLARE category_2 STRING;<br>DECLARE categories_for_pivot STRING;<br><br>SET category_1 = &#39;Office Supplies&#39;;<br>SET category_2 = &#39;Technology&#39;;<br>SET categories_for_pivot = &quot;&#39;Office Supplies&#39;,  &#39;Technology&#39;&quot;;<br>      <br>EXECUTE IMMEDIATE FORMAT(&quot;&quot;&quot; <br><br>WITH CTE <br>AS<br>(<br>        SELECT &#39;Corporate&#39; as Segment, &#39;%s&#39; AS Category, 653.00 as Sales <br>        UNION ALL <br>        SELECT &#39;Corporate&#39; as Segment, &#39;%s&#39; AS Category, 1979.89 as Sales <br>        UNION ALL <br>        SELECT &#39;Corporate&#39; as Segment, &#39;%s&#39; AS Category, 1292.94 as Sales<br>        UNION ALL <br>        SELECT &#39;Corporate&#39; as Segment, &#39;%s&#39; AS Category, 858.24 as Sales<br>        UNION ALL <br>        SELECT &#39;Consumer&#39; as Segment, &#39;%s&#39; AS Category, 783.96 as Sales<br>        UNION ALL <br>        SELECT &#39;Consumer&#39; as Segment, &#39;%s&#39; AS Category, 1447.65 as Sales<br>) <br><br>SELECT * FROM CTE <br>PIVOT<br>(<br>     SUM(Sales)<br>     FOR Category IN (%s)<br>)<br>&quot;&quot;&quot;,category_1, category_2, category_1, category_2, category_1, category_2, categories_for_pivot)</pre><p>Let’s dissect this code one step at a time.:</p><p><strong>DECLARE category_1 STRING, DECLARE category_2 STRING, DECLARE categories_for_pivot STRING</strong>: These lines declare three variables: category_1, category_2, and categories_for_pivot, all of which are of type STRING.</p><p><strong>SET category_1 = ‘Office Supplies’, SET category_2 = ‘Technology’, SET categories_for_pivot = “‘Office Supplies’, ‘Technology’”</strong>: These lines set the values of the variables:<br>category_1 is set to ‘Office Supplies’.<br>category_2 is set to ‘Technology’.<br>categories_for_pivot is set to “‘Office Supplies’, ‘Technology’”, which is a comma-separated string containing the values of category_1 and category_2.</p><p><strong>EXECUTE IMMEDIATE FORMAT(“”” … “””,category_1, category_2, category_1, category_2, category_1, category_2, categories_for_pivot)</strong>: This line executes a dynamic SQL statement using the EXECUTE IMMEDIATE command.</p><ul><li>Inside the FORMAT function, there’s a SQL query that consists of a Common Table Expression (CTE) named CTE and a PIVOT operation.</li><li>The %s placeholders in the SQL query are replaced by the values of the variables category_1, category_2, and categories_for_pivot, respectively.</li><li>The resulting SQL query dynamically generates a pivot table based on the categories provided.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*gbjY_WCq5xeruRxtI1BOCw.png" /><figcaption>Query Output</figcaption></figure><p>I trust you’ve found something valuable in this article. Recently, I integrated dynamic SQL into one of my projects and organized the entire script into a stored procedure in BigQuery. It would be a privilege if my insights could benefit even just one individual in their project endeavors. Here’s to continuous learning and growth!</p><p><a href="https://medium.com/@luhar.mitul/product-correlation-analysis-using-google-bigquery-1f5f0bc216e4">Product Correlation Analysis using Google BigQuery</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1c9dba809b9" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/how-can-one-unleash-the-potential-of-dynamic-sql-in-google-bigquery-f1c9dba809b9">How Can One Unleash the Potential of Dynamic SQL in Google BigQuery</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Product Correlation Analysis using Google BigQuery]]></title>
            <link>https://medium.com/@luhar.mitul/product-correlation-analysis-using-google-bigquery-1f5f0bc216e4?source=rss-91a5fa5935ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f5f0bc216e4</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Mitul Luhar]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 03:46:17 GMT</pubDate>
            <atom:updated>2024-05-03T22:59:31.204Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wondered how product correlation analysis boosts sales by suggesting winning product combinations and encouraging repeat purchases based on customer preferences?</p><p>At our company, we’re helping clients find their best-selling items and understand how customers shop. We do this by diving deep into the data from Shopify, looking at how first purchases correlate with second ones. This kind of analysis is super useful for businesses wanting to make the most of every sale.</p><p>And we’re using a cool tool called the CORR() function in Google BigQuery to make it happen. CORR() is one of the powerful statistical aggregate functions of GoogleSQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tQQDJjfMAB0vFz4XlpYXdg.jpeg" /></figure><p>Let’s dive into some interesting findings from our sample correlation analysis created using Power BI!</p><p>One hot product category we noticed is “Jumpsuits and Rompers,” which shows a strong positive correlation compared to others. Surprisingly, customers who buy “Jumpsuits and Rompers” are less likely to buy “Jeans”, as there’s a strong negative correlation there. Also, “Tops &amp; Tees” and “Jeans” rank second and third in positive correlation, suggesting an opportunity for upselling these items alongside “Jumpsuits and Rompers.”</p><p>Additionally, there’s potential for cross-selling “Leggings” and “Dresses” with “Jumpsuits and Rompers.” And here’s something curious: “Sweaters” seem to have a negative correlation with all other categories, leaving room for cross-selling various products with “Sweaters”.</p><p>Here are reference links to dive deeper into learning about CORR() function. Happy Learning !</p><p>Credit: Google</p><ul><li><a href="https://cloudplatform.googleblog.com/2013/09/introducing-corr-to-google-bigquery.html">Introducing CORR() to Google BigQuery</a></li><li><a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/statistical_aggregate_functions#corr">Statistical aggregate functions | BigQuery | Google Cloud</a></li><li><a href="https://medium.com/@luhar.mitul/how-can-one-unleash-the-potential-of-dynamic-sql-in-google-bigquery-f1c9dba809b9">How Can One Unleash the Potential of Dynamic SQL in Google BigQuery</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f5f0bc216e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>