<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hui Zheng (I/Trust/You)</title>
    <description>The latest articles on DEV Community by Hui Zheng (I/Trust/You) (@hui_zheng).</description>
    <link>https://dev.to/hui_zheng</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F653376%2Ff2f6916b-821d-47d3-bb9f-b2d8d6306dfc.jpeg</url>
      <title>DEV Community: Hui Zheng (I/Trust/You)</title>
      <link>https://dev.to/hui_zheng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hui_zheng"/>
    <language>en</language>
    <item>
      <title>Reducing GCP DataStream Sync Latency from PostgreSQL to BigQuery</title>
      <dc:creator>Hui Zheng (I/Trust/You)</dc:creator>
      <pubDate>Sat, 29 Jun 2024 06:34:29 +0000</pubDate>
      <link>https://dev.to/hui_zheng/reducing-gcp-datastream-sync-latency-from-postgresql-to-bigquery-6ff</link>
      <guid>https://dev.to/hui_zheng/reducing-gcp-datastream-sync-latency-from-postgresql-to-bigquery-6ff</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fstackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/78685229/reducing-gcp-datastream-sync-latency-from-postgresql-to-bigquery" rel="noopener noreferrer"&gt;
            Reducing GCP DataStream Sync Latency from PostgreSQL to BigQuery
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Jun 29 '24&lt;/span&gt;
            &lt;span&gt;Comments: 1&lt;/span&gt;
            &lt;span&gt;Answers: 0&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/78685229/reducing-gcp-datastream-sync-latency-from-postgresql-to-bigquery" rel="noopener noreferrer"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fstackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          1
        &lt;/div&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fstackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;I'm using GCP DataStream to sync data from PostgreSQL to BigQuery. However, I've noticed a delay of just over ten minutes in the data sync process. After digging into the documentation, I found that the issue is likely due to the default &lt;code&gt;max_staleness&lt;/code&gt; configuration for the BigQuery destination tables. By…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/78685229/reducing-gcp-datastream-sync-latency-from-postgresql-to-bigquery" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>BigQuery SQL Tip: QUALIFY clause</title>
      <dc:creator>Hui Zheng (I/Trust/You)</dc:creator>
      <pubDate>Fri, 10 Dec 2021 18:58:08 +0000</pubDate>
      <link>https://dev.to/hui_zheng/bigquery-qualify-clause-access-columns-differently-based-on-the-position-of-window-definition-9el</link>
      <guid>https://dev.to/hui_zheng/bigquery-qualify-clause-access-columns-differently-based-on-the-position-of-window-definition-9el</guid>
      <description>&lt;p&gt;In any SQL statement, There are two types of columns.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;columns available via the FROM clause&lt;/li&gt;
&lt;li&gt;columns as SELECT list aliases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I learn something new about QUALIFY clause in BigQuery lately on how it could access these columns differently based on the position of window definition.&lt;/p&gt;

&lt;p&gt;Please see example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH a AS (
    SELECT 
        *
    FROM UNNEST([STRUCT(1 AS val, 'in' AS canopy),
    (2, 'out'),
    (3, 'above'),
    (1, 'in')
    ])
)

-- Approach 1: QUALIFY only have access to columns available via the FROM clause

-- Case 1.1: 

-- SELECT
--     CASE WHEN canopy = 'above' THEN 'in'
--     ELSE canopy
--     END AS mapped_canopy,
--     val,
--     ROW_NUMBER() OVER w1 as rn,
-- FROM a
-- WHERE val IS NOT NULL
-- QUALIFY rn = 1
-- WINDOW w1 AS (PARTITION BY canopy)

-- Case 2: Invalid SQL

-- SELECT
--     CASE WHEN canopy = 'above' THEN 'in'
--     ELSE canopy
--     END AS mapped_canopy,
--     val,
--     ROW_NUMBER() OVER w1 as rn,
-- FROM a
-- WHERE val IS NOT NULL
-- QUALIFY rn = 1
-- WINDOW w1 AS (PARTITION BY mapped_canopy)

-- Approach 2: QUALIFY have access to both columns via the FROM clause and columns as SELECT list aliases

-- Case 3:

SELECT
    CASE WHEN canopy = 'above' THEN 'in'
    ELSE canopy
    END AS mapped_canopy,
    val
FROM a
WHERE val IS NOT NULL
QUALIFY ROW_NUMBER() OVER (PARTITION BY canopy) = 1

-- Case 4

-- SELECT
--     CASE WHEN canopy = 'above' THEN 'in'
--     ELSE canopy
--     END AS mapped_canopy,
--     val
-- FROM a
-- WHERE val IS NOT NULL
-- QUALIFY ROW_NUMBER() OVER (PARTITION BY mapped_canopy) = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>bigdata</category>
    </item>
    <item>
      <title>Finally, a Brightness Control on MacOS that rules all monitors (external or not)</title>
      <dc:creator>Hui Zheng (I/Trust/You)</dc:creator>
      <pubDate>Fri, 10 Dec 2021 17:50:19 +0000</pubDate>
      <link>https://dev.to/hui_zheng/finally-a-brightness-control-on-macos-that-rules-all-monitors-external-or-not-2ogh</link>
      <guid>https://dev.to/hui_zheng/finally-a-brightness-control-on-macos-that-rules-all-monitors-external-or-not-2ogh</guid>
      <description>&lt;p&gt;Enough said, &lt;/p&gt;

&lt;p&gt;I use multiple external monitors on my MacBook. The MacOS brightness control only works for built-in display, and it has always been a pain to adjust the brightness of those external monitors at night, until this comes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/MonitorControl/MonitorControl#readme"&gt;https://github.com/MonitorControl/MonitorControl#readme&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
    </item>
    <item>
      <title>Finally, a Brightness Control on MacOS that rules all monitors (external or not)</title>
      <dc:creator>Hui Zheng (I/Trust/You)</dc:creator>
      <pubDate>Wed, 03 Nov 2021 04:45:06 +0000</pubDate>
      <link>https://dev.to/hui_zheng/finally-a-brightness-control-on-macos-that-rules-all-monitors-external-or-not-4mgb</link>
      <guid>https://dev.to/hui_zheng/finally-a-brightness-control-on-macos-that-rules-all-monitors-external-or-not-4mgb</guid>
      <description>&lt;p&gt;I use multiple external monitors on my MacBook. It has always been a pain to adjust the brightness of those external monitors at night. The MacOS brightness control only works for built-in display. The buttons on monitor device are the only way to adjust the external monitor. &lt;/p&gt;

&lt;p&gt;Until this app comes along to rule it all. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/MonitorControl/MonitorControl#readme"&gt;https://github.com/MonitorControl/MonitorControl#readme&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>workstations</category>
    </item>
    <item>
      <title>make nice code snippet for presentation</title>
      <dc:creator>Hui Zheng (I/Trust/You)</dc:creator>
      <pubDate>Thu, 21 Oct 2021 19:00:14 +0000</pubDate>
      <link>https://dev.to/hui_zheng/nice-code-snippet-for-presentation-515l</link>
      <guid>https://dev.to/hui_zheng/nice-code-snippet-for-presentation-515l</guid>
      <description>&lt;p&gt;I found a very good tool to make good looking code snippet in presentation.&lt;/p&gt;

&lt;p&gt;It would show the code with syntax highlight in programming language that you chose.&lt;/p&gt;

&lt;p&gt;It's very good. give it a try next time when you make a presentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://romannurik.github.io/SlidesCodeHighlighter/"&gt;https://romannurik.github.io/SlidesCodeHighlighter/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>writing</category>
    </item>
  </channel>
</rss>
