<?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: Jeongho Son</title>
    <description>The latest articles on DEV Community by Jeongho Son (@json_27).</description>
    <link>https://dev.to/json_27</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%2F3264997%2Fab928bea-865a-4c42-996e-ec68bc599c1c.jpeg</url>
      <title>DEV Community: Jeongho Son</title>
      <link>https://dev.to/json_27</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/json_27"/>
    <language>en</language>
    <item>
      <title>Be Careful with @run_date in BigQuery Scheduled Queries – Especially in KST/JST!</title>
      <dc:creator>Jeongho Son</dc:creator>
      <pubDate>Thu, 19 Jun 2025 15:17:13 +0000</pubDate>
      <link>https://dev.to/json_27/be-careful-with-rundate-in-bigquery-scheduled-queries-especially-in-kstjst-1n7g</link>
      <guid>https://dev.to/json_27/be-careful-with-rundate-in-bigquery-scheduled-queries-especially-in-kstjst-1n7g</guid>
      <description>&lt;p&gt;In Google BigQuery, there’s a convenient function called @run_date. It automatically sets the reference date for your query to the time it is executed. Sounds great, right?&lt;/p&gt;

&lt;p&gt;Well... only if you're manually running the query from the Scheduled Queries UI. If you set it to run automatically at a scheduled time, and you haven’t explicitly set the timezone, the query will run in UTC.&lt;/p&gt;

&lt;p&gt;Here’s the catch:&lt;br&gt;
For countries like South Korea or Japan(UTC+9), this can lead to unexpected behavior, especially if your query runs across midnight UTC.&lt;br&gt;
A job scheduled for 9:00 AM KST will actually run at midnight UTC, and @run_date will evaluate to the previous date in local time. That’s a nasty, silent bug waiting to happen.&lt;/p&gt;

&lt;p&gt;To avoid this mess, always set the timezone explicitly when scheduling queries.&lt;br&gt;
And more importantly, use @run_time instead of @run_date if you need to control the exact time, with timezone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- You don't need to wrap with DATE() unless you need a DATE type
DATE(@run_time, 'Asia/Seoul')
DATE(@run_time, 'Asia/Tokyo')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unfortunately, many of the datamarts in our team were built using @run_date without timezone awareness, so now there’s a mountain of fixes ahead. But hey... we'll survive. Somehow. Ha!&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://qiita.com/sushi_edo/items/8250902ce2af778c2e8f" rel="noopener noreferrer"&gt;https://qiita.com/sushi_edo/items/8250902ce2af778c2e8f&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>구글 빅쿼리 @run_date 함수에 관하여</title>
      <dc:creator>Jeongho Son</dc:creator>
      <pubDate>Thu, 19 Jun 2025 15:15:48 +0000</pubDate>
      <link>https://dev.to/json_27/gugeul-bigkweori-rundate-hamsue-gwanhayeo-3om8</link>
      <guid>https://dev.to/json_27/gugeul-bigkweori-rundate-hamsue-gwanhayeo-3om8</guid>
      <description>&lt;p&gt;구글 빅쿼리에는 &lt;code&gt;@run_date&lt;/code&gt;라는 함수가 있는데 이 함수를 이용하면 쿼리를 실행할 때 데이터 집계 기준 시간을 쿼리 실행시각으로 자동 설정할 수 있다.&lt;/p&gt;

&lt;p&gt;단, 어디까지나 구글 빅쿼리의 스케줄된쿼리 메뉴에서 사용자가 수동으로 쿼리를 실행할 때의 이야기이고 정해진 시각에 자동으로 실행하도록 설정되어 있는 쿼리에 대해선 따로 시각을 설정해두지 않으면 세계표준시(UTC)로 실행되어버린다.&lt;/p&gt;

&lt;p&gt;이 경우 한국,일본과 같이 세계표준시보다 9시간 빠른 국가의 경우에 쿼리의 실행시간이 날짜를 걸쳐서 실행되면 의도하지 않은 결과를 낳을 수 있기 때문에 주의를 요한다.&lt;/p&gt;

&lt;p&gt;이를 방지하기 위해 타임존을 따로 설정할 수 있는데, 타임존을 설정할 경우엔 &lt;code&gt;@run_date&lt;/code&gt;가 아니라 &lt;code&gt;@run_time&lt;/code&gt; 함수를 사용하여야한다.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- 타임스탬프형으로 사용하고 싶은 경우엔 굳이 DATE함수를 사용하지 않아도 괜찮다.
DATE(@run_time,'Asia/Seoul')
DATE(@run_time,'Asia/Tokyo')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;팀내에서 만든 데이터마트들이 타임존 설정 없이 죄다 @run_date로 설정되어 있었기 때문에, 앞으로 고쳐야할 부분이 산더미 같지만...뭐 어떻게든 되겠지 하하...&lt;/p&gt;

&lt;p&gt;참고 문서: &lt;a href="https://qiita.com/sushi_edo/items/8250902ce2af778c2e8f" rel="noopener noreferrer"&gt;https://qiita.com/sushi_edo/items/8250902ce2af778c2e8f&lt;/a&gt;&lt;/p&gt;

</description>
      <category>bigquery</category>
    </item>
    <item>
      <title>How to Undo git add / git commit / git push</title>
      <dc:creator>Jeongho Son</dc:creator>
      <pubDate>Sat, 14 Jun 2025 13:38:32 +0000</pubDate>
      <link>https://dev.to/json_27/how-to-undo-git-add-git-commit-git-push-2e3j</link>
      <guid>https://dev.to/json_27/how-to-undo-git-add-git-commit-git-push-2e3j</guid>
      <description>&lt;p&gt;Goal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be able to undo git add.&lt;/li&gt;
&lt;li&gt;Be able to undo git commit.&lt;/li&gt;
&lt;li&gt;Be able to undo git push.&lt;/li&gt;
&lt;li&gt;Be able to delete untracked files.&lt;/li&gt;
&lt;li&gt;Be able to restore modified files back to their original state before changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Undo git add (Unstage Files)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you accidentally add files to the staging area that you didn’t intend to include:&lt;/li&gt;
&lt;li&gt;You can remove files from the staging area without deleting your actual changes.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# First, check the file status
$ git status

# To unstage a specific file
$ git reset HEAD &amp;lt;file_name&amp;gt;

# To unstage all files from the staging area
$ git reset HEAD

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Undo git commit&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you accidentally committed files you didn’t intend to:&lt;/li&gt;
&lt;li&gt;If you forgot to include certain files and committed too early.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Check commit history
$ git log

# 1. Undo the commit but keep the changes staged (as if `git add` was done)
$ git reset --soft HEAD^

# 2. Undo the commit and unstage the changes (files remain in the working directory)
$ git reset --mixed HEAD^  # --mixed is the default, so you can omit it

# 3. Undo the commit and discard all changes (files will be deleted)
$ git reset --hard HEAD^

# If you want to reset your working directory to the latest commit from the remote (not recommended)
$ git reset --hard HEAD

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Undo git push&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're not working on a shared repository, it's usually fine.
But if you're collaborating with others, always discuss with your teammates before undoing a push.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reason:&lt;br&gt;
Commits made after the one you're reverting will be lost.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Personally, I try to avoid canceling a push.&lt;br&gt;
Instead, I prefer modifying the files and committing the changes again.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That way, the edit history is preserved and it's easier for teammates to track what was fixed.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Undo the latest commit
$ git reset HEAD^

# 2. Check the commit history
$ git log

# 3. Reset the working directory to a specific commit
$ git reset &amp;lt;commit_id&amp;gt;

# 4. After making necessary changes, force push to the remote repository (force push will overwrite remote history)
$ git push -f origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Appendix 1: Deleting Untracked Files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For some reason, untracked files tend to pile up while working...
Since I can't stand messy workspaces, I clean them up pretty often
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Delete untracked files
$ git clean -f

# Delete untracked files and directories
$ git clean -f -d

# Delete untracked files, directories, and ignored files
$ git clean -f -d -x

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Appendix 2: Changing Commit Messages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you wrote the wrong commit message, you can change it using the following command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Embulk &amp; Digdag (Loading into Google BigQuery)</title>
      <dc:creator>Jeongho Son</dc:creator>
      <pubDate>Sat, 14 Jun 2025 13:23:39 +0000</pubDate>
      <link>https://dev.to/json_27/embulk-digdag-loading-into-google-bigquery-5830</link>
      <guid>https://dev.to/json_27/embulk-digdag-loading-into-google-bigquery-5830</guid>
      <description>&lt;p&gt;Recently, I've been experimenting with ETL tools while learning data engineering. Every time I hear "ETL," I can't help but think of NewJeans' ETA... It's driving me crazy.&lt;/p&gt;

&lt;p&gt;Anyway, here’s a quick summary of two open-source tools: Embulk and Digdag — especially when you're loading data into Google BigQuery.&lt;/p&gt;

&lt;p&gt;Embulk: OSS Tool for Data Transfer (Load) Between DBs, Storages, File Formats, and Cloud Services&lt;br&gt;
You can easily transfer local files into Google Cloud BigQuery using Embulk.&lt;/p&gt;

&lt;p&gt;You write a simple .yml configuration file to define input and output:&lt;br&gt;
(e.g. which file to read, how to parse it, and where to load it.)&lt;/p&gt;

&lt;p&gt;Execution is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
embulk run &amp;lt;file_name.yml&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tip: When handling JSON files, make sure to define only one column during parsing.&lt;/p&gt;

&lt;p&gt;Digdag: Task Pipeline, Scheduling, and Workflow Automation&lt;br&gt;
In simple terms, Digdag is a workflow automation tool.&lt;/p&gt;

&lt;p&gt;After extracting data, you can run SQL queries on the table and load the processed results back into BigQuery.&lt;/p&gt;

&lt;p&gt;Of course, you can also specify target table names during the workflow.&lt;/p&gt;

&lt;p&gt;To execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
digdag run &amp;lt;file_name.dig&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Workflow&lt;br&gt;
Here’s a simple example of how Embulk and Digdag can be combined:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Load CSV File using Embulk (Input &amp;amp; Output)&lt;/li&gt;
&lt;li&gt;Parse the file and load it into a staging table.&lt;/li&gt;
&lt;li&gt;Transform the Loaded Table using SQL&lt;/li&gt;
&lt;li&gt;Use SELECT to extract and split specific fields into proper columns.&lt;/li&gt;
&lt;li&gt;Load the Transformed Data into a Final Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Very simple but very effective combo when you're dealing with lightweight ETL pipelines into BigQuery.&lt;/p&gt;

&lt;p&gt;Official Google BigQuery Docs&lt;/p&gt;

&lt;p&gt;JSON functions: &lt;a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions" rel="noopener noreferrer"&gt;https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conversion functions : &lt;a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions" rel="noopener noreferrer"&gt;https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;data-types : &lt;a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types" rel="noopener noreferrer"&gt;https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
