<?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 Ivan on Medium]]></title>
        <description><![CDATA[Stories by Ivan on Medium]]></description>
        <link>https://medium.com/@Not4j?source=rss-273c69a70a68------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6Fxi5yBmkx5GHTbf.</url>
            <title>Stories by Ivan on Medium</title>
            <link>https://medium.com/@Not4j?source=rss-273c69a70a68------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:46:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Not4j/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[Enhancing DBT Workflows with Dynamic Tag-Based Macros]]></title>
            <link>https://medium.com/@Not4j/enhancing-dbt-workflows-with-dynamic-tag-based-macros-93717380c034?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/93717380c034</guid>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 15:56:56 GMT</pubDate>
            <atom:updated>2024-02-20T15:56:56.995Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OznJvO98gJSmPTmT" /><figcaption>Photo by <a href="https://unsplash.com/@domlafou?utm_source=medium&amp;utm_medium=referral">Dom Fou</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the world of modern data analytics and transformation, the Data Build Tool (DBT) has emerged as a cornerstone for managing SQL-based workflows within data warehouses. A powerful feature of DBT lies in its ability to leverage Jinja, a templating engine for Python, enabling developers to create dynamic and reusable code snippets. I will cover one such example. A macro that I have crafted macro designed to collect DBT models based on tags. In this article, we’ll delve into the significance of DBT tags, explore the necessity of executing code within DBT macros, and outline various use cases where the get_models_by_tag macro proves invaluable.</p><h3>Understanding DBT Tags</h3><p>First thing first, what are DBT tags? DBT tags serve as metadata labels assigned to DBT resources, including models, sources, or seeds. They provide a means for organizing and categorizing these resources based on criteria such as functionality, departmental ownership, or business unit. Tags offer clarity and structure within DBT projects, aiding in documentation, testing, deployment, and monitoring.</p><p>A tag could be placed really simply:</p><pre>{{ config(<br> tags=[&quot;finance&quot;]<br>) }}<br>select * from …</pre><p>As a result, you could perform any DBT operation over the group of models defined by the tag. Let’s say you need to rebuild all models dedicated to finance data:</p><pre>dbt run - select tag:finance</pre><p>Or run you hourly pipeline:</p><pre><br>dbt run — select tag:hourly</pre><p>That is super flexible and easy.</p><h3>DBT Tags and Jinja macro</h3><p>But what if I need to perform some action over tagged models from DBT Jinja macro? Let’s say: the pipeline has crafted some new models and I want to have a macro that will do some complex cleanup of the temporary table that is not possible to be done by `post-hook` of DBT. Sorry, you could not collect a list of models by tag from the macro code… until you create your macro.</p><pre>{% macro get_models_by_tag(tag) %}<br> {% set models = [] -%}<br>   {% if execute %}<br>     {% for node in graph.nodes.values()<br>     | selectattr(&quot;resource_type&quot;, &quot;equalto&quot;, &quot;model&quot;)<br>     | selectattr(&quot;config.enabled&quot;, &quot;equalto&quot;, True) %}<br>       {% if tag in node.tags %}<br>         {% do models.append((&quot;dm_&quot; ~ type_tag, node.name)) %}<br>       {% endif %}<br>     {% endfor %}<br>   {% endif %}<br> {{ return(models) }}<br>{% endmacro %}</pre><p>You could collect a full list of models from <em>graph </em>object, which will appear after doing `dbt compile/dbt run` and will be stored in <em>manifest </em>file. Next, we need to filter out disabled nodes and collect only <em>models</em>. The last step — is to check if the target tag exists in the tags list of each node. And that is it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93717380c034" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: June 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-june-2023-207517f46b93?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/207517f46b93</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[stockholm]]></category>
            <category><![CDATA[rental]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 08:59:21 GMT</pubDate>
            <atom:updated>2023-07-10T08:59:21.272Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Initially, it started as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are currently looking for an apartment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the beginning of July 2023. It is possible to take a look at June’23 data.</p><p>Let’s begin with a number of apartments rented out on June’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*9oloG3v1bqsb1aqzPxzQ1g.png" /><figcaption>After a huge rise in May, we could see that June has set new top level</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to May’23:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBMzcHhUq8HySXfyhm9lqg.png" /><figcaption>No significant changes. The number of 1.5 bedrooms is going a little bit down, while the number of 3 bedroom apartments is going slightly up</figcaption></figure><p>Let’s take a look at a median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pBEG_5EyLAdzD0qZKhMxKQ.png" /></figure><p>Exact median prices (compared to May’23 prices):</p><ul><li>1 bedroom — 11400 (+0 SEK) SEK/month</li><li>1.5 bedrooms — 13000 (+0 SEK) SEK/month</li><li>2 bedrooms — 15300 (+200SEK) SEK/month</li><li>2.5 bedrooms — 16000 (+200 SEK) SEK/month</li><li>3 bedrooms — 18200 (+600 SEK) SEK/month</li></ul><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*wxviyUTaIWEQS4hINUmpsQ.png" /></figure><p>The median price is 16400 (-100 SEK) SEK/month for June’23.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzTBND11Lcn9kD0Un7DjNQ.png" /></figure><p>Here we have 16200 (-200 SEK) SEK/month for not-pet-friendly apartments and 16800 (-200 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=207517f46b93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: May 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-may-2023-afaacab5a844?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/afaacab5a844</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[stockholm]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 08:49:44 GMT</pubDate>
            <atom:updated>2023-07-10T08:49:44.118Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Initially, it started as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are currently looking for an apartment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the end of June 2023. It is possible to take a look at May’23 data.</p><p>Let’s begin with a number of apartments rented out on May’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*a-Ownqaf9BRI5KIAbZEV-w.png" /><figcaption>We have a huge boost in May, number of rented out apartments is increased almost 32% comparing to Apr’23</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Apr’23:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYcVdDoBa3eMm6ve1ufDtQ.png" /><figcaption>The biggest rise was for 2 (almost 100 additional apartments) and 1 (50 additional)bedroom apartments.</figcaption></figure><p>Let’s take a look at a median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_U4f1H0U4trn9weGvB2Tg.png" /></figure><p>Exact median prices (compared to Apr’23 prices):</p><ul><li>1 bedroom — 11400 (+400 SEK) SEK/month</li><li>1.5 bedrooms — 13000 (+0 SEK) SEK/month</li><li>2 bedrooms — 15100 (+100SEK) SEK/month</li><li>2.5 bedrooms — 15800 (-800 SEK) SEK/month</li><li>3 bedrooms — 17600 (+100 SEK) SEK/month</li></ul><p>After a huge price increase in Apr’23 we could see a moderate rise in price in May. In the case of 2.5 bedrooms, there is a huge price decrease, but mostly it is because in Apr’23 there was really significant rise in 1600 SEK for that type of apartment.</p><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*tEK7KgYRPn4kM5qFo3d2rw.png" /></figure><p>The median price is 16500 (+300 SEK) SEK/month for May’23. That is really interesting, looks like it is happening because of an increasing number of 2 bedroom flats.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LPEZxg946tMbGw9BOyKBg.png" /></figure><p>Here we have 16400 (+300 SEK) SEK/month for not-pet-friendly apartments and 17000 (+0 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afaacab5a844" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: April 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-april-2023-b14bef5f1cd1?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/b14bef5f1cd1</guid>
            <category><![CDATA[stockholm]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Fri, 26 May 2023 20:39:31 GMT</pubDate>
            <atom:updated>2023-05-26T20:39:31.174Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the end of May 2023. It is possible to take a look at April’23 data.</p><p>Let’s begin with a number of apartments rented out on Apr’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*UiDT0rVf1kIrqaS6xLJ6bA.png" /></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Mar’23:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2EzItbNZcyqTlAXv1rb4Q.png" /></figure><p>Let’s take a look at a median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xO_XpnomznxYot1dxlBS3A.png" /></figure><p>Exact median prices (compared to Mar’23 prices):</p><ul><li>1 bedroom — 11000 (+500 SEK) SEK/month</li><li>1.5 bedrooms — 13000 (+-0 SEK) SEK/month</li><li>2 bedrooms — 15000 (+100SEK) SEK/month</li><li>2.5 bedrooms — 16600 (+1600 SEK !!!) SEK/month</li><li>3 bedrooms — 17500 (+800 SEK) SEK/month</li></ul><p>Huge rise in median price with big flats (2.5 and 3 bedroom apartments). In overall, there is a rising trend in rental prices.</p><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK7--X_BxF_n0h3xQIHyfA.png" /></figure><p>The median price is 16200 (-200 SEK) SEK/month for Apr’23. That is really interesting, looks like it is happening because of an increasing number of 2 bedroom flats.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpyKyNPaBLorFbMuvo4MnA.png" /></figure><p>Here we have 16100 (-400 SEK) SEK/month for not-pet-friendly apartments and 17000 (-300 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b14bef5f1cd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: March 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-march-2023-6271f595426c?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/6271f595426c</guid>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[stockholm]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Fri, 07 Apr 2023 10:55:00 GMT</pubDate>
            <atom:updated>2023-04-07T11:33:24.944Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the beginning of April 2023. It is possible to take a look at March’23 data.</p><p>Let’s begin with a number of apartments rented out in Mar’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*Dlxt1C6ZWL5CeATKMBnP5Q.png" /><figcaption>Compared to Feb’23 there were rented 10% more apartments.</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Feb’23:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fDUOVAQLmq5eMDMDNckbhw.png" /></figure><p>Let’s take a look at a median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNo3edImaG3Dwf6fJ90l7Q.png" /></figure><p>Exact median prices (compared to Feb’23 prices):</p><ul><li>1 bedroom — 10500 (-500 SEK) SEK/month</li><li>1.5 bedrooms — 13000 (-500SEK) SEK/month</li><li>2 bedrooms — 14900 (+400SEK) SEK/month</li><li>2.5 bedrooms — 15000 (-900 SEK !!!) SEK/month</li><li>3 bedrooms — 16700 (-1400SEK) SEK/month</li></ul><p>Huge drop in median price with big flats (2.5 and 3 bedroom apartments). In overall, there is a falling trend in rental prices.</p><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1LJQj_DFxPGoVFunuHFHw.png" /></figure><p>The median price is 16400 (+400 SEK) SEK/month for Mar’23. That is really interesting, looks like it is happening because of the increase in price in 2-bedroom apartments and the rising amount of apartments rented out at the same time.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CA-iyAReVzRQiZS6Om1nnA.png" /></figure><p>Here we have 16400 (+500 SEK) SEK/month for not-pet-friendly apartments and 17300 (+300 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6271f595426c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: February 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-february-2023-3b680f1fac97?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b680f1fac97</guid>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[stockholm]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Sat, 11 Mar 2023 19:01:43 GMT</pubDate>
            <atom:updated>2023-04-07T11:31:27.935Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the beginning of March 2023. It is possible to take a look at February’23 data.</p><p>Let’s begin with a number of apartments rented out in Feb’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*GYX3fNZEs6nGvgj0uxoFuw.png" /><figcaption>Compared to Jan’23 there were rented 20% fewer apartments. We experienced 20% increase in Jan’23 compared to Dec’22. Looks like we have returned to an average level.</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Jan’23:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IgN6gxsCujQ_bJQOxAM4-g.png" /><figcaption>Jan’23 at left, Feb’23 at right. We could see that only 3 bedrooms apartments were rented out at the same level, all others were on a falling trend.</figcaption></figure><p>Let’s take a look at a median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7PKnxCZKDGmN39vgsdp1dw.png" /><figcaption>The median price for apartments in Feb’23, Stockholm</figcaption></figure><p>Exact median prices (compared to Jan’23 prices):</p><ul><li>1 bedroom — 11000 (-100SEK) SEK/month</li><li>1.5 bedrooms — 13500 (+100SEK) SEK/month</li><li>2 bedrooms — 14500 (-1000SEK) SEK/month</li><li>2.5 bedrooms — 15900 (-100 SEK) SEK/month</li><li>3 bedrooms — 18100 (-1200SEK) SEK/month</li></ul><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__qUZ4RtOwZQ_uKYsho4uQ.png" /></figure><p>The median price is 16000 (+0 SEK) SEK/month for Feb’23.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*LNvFY0pIpSO-bn4uOtPjnA.png" /></figure><p>Here we have 15900 (+100 SEK) SEK/month for not-pet-friendly apartments and 17000 (-100 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b680f1fac97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Timestamp to string conversion (Redshift vs Snowflake) issue]]></title>
            <link>https://medium.com/@Not4j/timestamp-to-string-conversion-redshift-vs-snowflake-issue-d670c5c58a2a?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/d670c5c58a2a</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[redshift]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Fri, 10 Feb 2023 09:00:27 GMT</pubDate>
            <atom:updated>2023-07-11T09:19:56.018Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W4wBI9A0KbfXKNQq" /><figcaption>Photo by <a href="https://unsplash.com/@agebarros?utm_source=medium&amp;utm_medium=referral">Agê Barros</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Everyone faces some strange behavior in software products from time to time. Any software has bugs, so it does not surprise us much. However, in some case you facing not a clear but some kind of strange implementation that surprise you. I have such one from our <a href="https://medium.com/@Not4j/scentbird-analytics-2-0-migrate-from-redshift-to-snowflake-redesign-etl-process-e79611723a90">Redshift to Snowflake migration</a>:</p><pre>select<br>    cast(TIMESTAMP &#39;2021-03-19 17:07:10.123321&#39; as varchar),<br>    cast(TIMESTAMP &#39;2021-03-19 17:07:10.123000&#39; as varchar),<br>    cast(TIMESTAMP &#39;2021-03-19 17:07:10.100000&#39; as varchar),<br>    cast(TIMESTAMP &#39;2021-03-19 17:07:10.000000&#39; as varchar);</pre><p>Redshift output:</p><pre>2021-03-19 17:07:10.123321,<br>2021-03-19 17:07:10.123,<br>2021-03-19 17:07:10.10,<br>2021-03-19 17:07:10</pre><p>Snowflake output:</p><pre>2021-03-19 17:07:10.123321,<br>2021-03-19 17:07:10.123000,<br>2021-03-19 17:07:10.100000,<br>2021-03-19 17:07:10.000000</pre><p>At first glance, Redshift just cut trailing 0. Do not hurry! Pay attention to the 3rd date 2021-03-19 17:07:10.100000. Redshift will convert it really strange form 2021-03-19 17:07:10.10 with trailing zero. I could not explain why it happens in such a way. But it is what it is - Redshift converts data to string in a quite unexpected way.</p><p>You can say: Well, actually it is not a big deal. You could read all of the values in both cases, so there is no harm. Correct, in terms of just string output, it is totally ok. But we were not so lucky: our data model heavily uses hash keys over several fields in a table. So to combine all of them to build hash code (actually we are using <a href="https://github.com/dbt-labs/dbt-utils#surrogate_key-source">DBT function</a> that does it for us) we are converting every field to a string... I bet you already have an idea of what&#39;s going wrong with our hashes. Due to different algorithms for string conversion, we were getting unequal hashes over the same columns and the same values in them. Old Redshift hashes should be somehow converted to Snowflake base. We have created such a function to run it over Snowflake and convert all broken references build on top of hashes:</p><pre>alter account set TIMESTAMP_NTZ_OUTPUT_FORMAT = &#39;YYYY-MM-DD HH24:MI:SS.FF6&#39;;<br><br>alter table public.some_table add column unique_id_redshift varchar;<br><br>update public.some_table c set uniq_id_redshift = md5(cast(<br>                          coalesce(cast(c.some_regular_column1 as varchar), &#39;&#39;) || &#39;-&#39;<br>                      || coalesce(<br><br>                            case<br>                                when LEN(RTRIM(cast(c.date_started as varchar), &#39;0&#39;)) - POSITION(&#39;.&#39;, RTRIM(cast(c.date_started as varchar), &#39;0&#39;)) &gt; 1 then RTRIM(cast(c.date_started as varchar), &#39;0&#39;)<br>                                when LEN(RTRIM(cast(c.date_started as varchar), &#39;0&#39;)) - POSITION(&#39;.&#39;, RTRIM(cast(c.date_started as varchar), &#39;0&#39;)) = 0 then coalesce(substr(RTRIM(cast(c.date_started as varchar), &#39;0&#39;), 0, LEN(RTRIM(cast(c.date_started as varchar), &#39;0&#39;))-1), &#39;&#39;)<br>                                else RTRIM(cast(c.date_started as varchar), &#39;0&#39;) || &#39;0&#39;<br>                                end<br><br>                              , &#39;&#39;) || &#39;-&#39;<br>              || coalesce(cast(c.some_regular_column2 as varchar), &#39;&#39;) || &#39;-&#39;<br>      || coalesce(cast(c.some_regular_column2 as varchar), &#39;&#39;) as varchar));<br><br>update table_with_invalid_key_reference f set f.some_table_unique_id = c.snowflake_calculated_hash<br>from some_table c<br>where f.some_table_unique_id = c.unique_id_redshift;<br><br>...<br><br>alter table public.some_table drop column unique_id_redshift;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d670c5c58a2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: January 2023]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-january-2023-8caa09affaae?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/8caa09affaae</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[stockholm]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 11:12:57 GMT</pubDate>
            <atom:updated>2023-03-11T18:31:06.777Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the beginning of February 2023. It is possible to take a look at January’23 data.</p><p>Let’s begin with a number of apartments rented out in Jan’23</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*S4DY8aYNBON7mm9S5UiBFQ.png" /><figcaption>Compared to Dec’22 there were rented almost 21% more apartments. Possibly, because a lot of rental agreements could end up in January.</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Dec’22:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x1XW5eI22J0eI9CoBTFATA.png" /><figcaption>Dec’22 at left, Jan’23 at right. We could see that fewer only 3 bedrooms apartments were rented out, all other were on the rising trend.</figcaption></figure><p>Let’s take a look at an median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2iPn_4SIIh3WIW2r6EGbQ.png" /><figcaption>The median price for apartments in Jan’23, Stockholm</figcaption></figure><p>Exact median prices (compared to Dec’22 prices):</p><ul><li>1 bedroom — 11100 (+200SEK) SEK/month</li><li>1.5 bedrooms — 13400 (+300SEK) SEK/month</li><li>2 bedrooms — 15500 (+200SEK) SEK/month</li><li>2.5 bedrooms — 16000 (+400 SEK) SEK/month</li><li>3 bedrooms — 19300 (-1500SEK) SEK/month</li></ul><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*A2lzVMw09p1RnuQMv24f-Q.png" /></figure><p>The median price is 16000 (+300SEK) SEK/month for Jan’23.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ba5Hcx1BDLzy2Cu7fVG8eA.png" /></figure><p>Here we have 15800 (+300 SEK) SEK/month for non-pet-friendly apartments and 17100 (+100 SEK) SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8caa09affaae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Montenegro rental market statistics: December 2022]]></title>
            <link>https://medium.com/@Not4j/montenegro-rental-market-statistics-december-2022-d19a90ff32af?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/d19a90ff32af</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[montenegro]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Wed, 18 Jan 2023 17:19:47 GMT</pubDate>
            <atom:updated>2023-01-18T17:19:47.681Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals and telegram channels. Now all listings are coming in one </em><a href="https://t.me/me_estate_rental"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment. There is a similar </em><a href="https://t.me/fresh_me_estate"><em>telegram</em></a><em> channel for the property on sale.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now in January 2023. It is possible to take a look at December’22 data.</p><p>Let’s begin with a number of apartments rented out in Dec’22</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*Mb2OWTB5hMIkfuWiTLJo2A.png" /><figcaption>Compared to Nov’22 there were rented 9% more apartments (~2750 units in total)</figcaption></figure><p>The median price for rent over the whole of Montenegro:</p><ul><li>apartment — 500 €/Month</li><li>house — 1500 €/Month</li></ul><p>Let’s take a look at detailed statistics across the most popular 3 cities in Montenegro by the number of rented units: Podgorica, Budva, and Tivat.</p><h3>Podgorica</h3><p>Over median price is <strong>500</strong> €/month. Let’s take a look at the median price by bedroom number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOrKHt7dEcJEfoqmL5g5_w.png" /><figcaption>The median price for apartments in Dec’22, Podgorica</figcaption></figure><p>It is not really obvious from the chart what are exact prices. Here they are (0 bedrooms is just lots without any specification on rooms number):</p><ul><li>1-bedroom — 450 €/month</li><li>2-bedroom — 650 €/month</li><li>3-bedroom — 950 €/month</li><li>4/5-bedroom — 2000 €/month</li></ul><p>Now let’s take a look at the median price by type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OFSP3QQqBwDxJa81UjKjw.png" /><figcaption>The median price for apartments in Dec’22, Podgorica by type</figcaption></figure><ul><li>House — 1800 €/month</li><li>Apartments — 450 €/month</li></ul><h3>Budva</h3><p>Over median price is 7<strong>00</strong> €/month. Let’s take a look at the median price by bedroom number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQsnnV6sDd1CS8DzNyqHrQ.png" /><figcaption>The median price for apartments in Dec’22, Budva</figcaption></figure><p>Here they are (0 bedrooms is just lots without any specification on rooms number):</p><ul><li>1-bedroom — 600 €/month</li><li>2-bedroom — 1100 €/month</li><li>3-bedroom — 1200 €/month</li></ul><p>Now let’s take a look at the median price by type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQyg6rzX7oAGNtMTJkajvA.png" /><figcaption>The median price for apartments in Dec’22, Podgorica by type</figcaption></figure><ul><li>House — 2500 €/month (only 1 house was rented out)</li><li>Apartments — 700 €/month</li></ul><h3>Tivat</h3><p>Over median price is <strong>900</strong> €/month. Let’s take a look at the median price by bedroom number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-dwy8jfgBaisFOHAApXoQ.png" /><figcaption>The median price for apartments in Dec’22, Tivat</figcaption></figure><p>Here they are (0 bedrooms is just lots without any specification on rooms number):</p><ul><li>1-bedroom — 875 €/month</li><li>2-bedroom — 800 €/month</li><li>3-bedroom — 1500 €/month</li></ul><p>That is interesting that the 1-bedroom median price is higher compared to a 2-bedroom apartment.</p><p>Now let’s take a look at the median price by type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLhBsvg5EQWdDtEjS5j-dg.png" /><figcaption>The median price for apartments in Dec’22, Podgorica by type</figcaption></figure><ul><li>House — 900 €/month (only 5 houses were rented out)</li><li>Apartments — 900 €/month</li></ul><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d19a90ff32af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stockholm rental market statistics: December 2022]]></title>
            <link>https://medium.com/@Not4j/stockholm-rental-market-statistics-jan-2023-77ac6f7379fa?source=rss-273c69a70a68------2</link>
            <guid isPermaLink="false">https://medium.com/p/77ac6f7379fa</guid>
            <category><![CDATA[rental]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[rental-property]]></category>
            <category><![CDATA[stockholm]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Ivan]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 18:15:20 GMT</pubDate>
            <atom:updated>2023-01-09T11:13:46.297Z</atom:updated>
            <content:encoded><![CDATA[<p><em>I’ve been tracking rental data in the Stockholm region for several months. Originally, it starts as a project to track new apartments listed for rent to avoid manually checking new listings on apartment portals. New listings are coming in the </em><a href="https://t.me/sthlm_rent"><em>telegram</em></a><em> channel. That is very useful if you are looking for an apartment at the moment.</em></p><p><em>As a side-effect, I get a lot of data about the rental market. I decided to do a basic analysis and share some statistics.</em></p><p>Ok, we are now at the beginning of January 2023. It is possible to take a look at December’22 data.</p><p>Let’s begin with a number of apartments rented out in Dec’22</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*OIJcAqHkwHDWAAT1mTNqtQ.png" /><figcaption>Compared to Nov’22 there were rented almost 12% fewer apartments</figcaption></figure><p>Let’s take a look at how many apartments by the number of bedrooms were rented out compared to Nov’22:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDZjcwsWz4_Hh7-q0xG7UA.png" /><figcaption>Nov’22 at left, Dec’22 at right. We could see that fewer 1 and 2 bedrooms apartments were rented out. At the same time, 3 and 1.5 bedrooms are almost equal.</figcaption></figure><p>Let’s take a look at an median price per month by bedrooms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sdensR0Rn1U1yJny1yF3Q.png" /><figcaption>The median price for apartments in Dec’22, Stockholm</figcaption></figure><p>It is not really obvious from the chart what are exact prices. Here they are:</p><ul><li>1 bedroom — 10900 SEK/month</li><li>1.5 bedrooms — 13100 SEK/month</li><li>2 bedrooms — 15300 SEK/month</li><li>2.5 bedrooms — 15600 SEK/month</li><li>3 bedrooms — 20800 SEK/month</li></ul><p>So let’s take a look at the median price overall:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*gL-tpsKwsSJ8LaVcymdTFQ.png" /><figcaption>It is not obvious from that chart what is median price exactly. It is 15700 SEK/month for Dec’22.</figcaption></figure><p>So the median price is 15700 SEK/month for Dec’22.</p><p>I also was wondering what is the median price to pay in case you have a pet (as I do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*nKxGiB1EEWhDfo0X-WE7PA.png" /><figcaption>Once again tricky to figure out exact numbers.</figcaption></figure><p>Here we have 15500 SEK/month for non-pet-friendly apartments and 17000 SEK/month for pet-friendly apartments. If you have a pet you have to pay some extra money to a landlord.</p><p>That’s it. Will be adding extra metrics in future months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77ac6f7379fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>