Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GoによるSQLクエリテストの取り組み / Using Go to Implement SQL Query Tests

mercari
October 14, 2023

GoによるSQLクエリテストの取り組み / Using Go to Implement SQL Query Tests

メルペイ加盟店の管理システムを開発しているチームには、複雑な条件を持つBigQueryのSQLクエリがいくつか存在しています。例えば、加盟店管理に関する費用計算などの計算クエリのように、外部環境の変化によって要件が定期的に変更され、マイクロサービス化などのシステム化が難しいクエリがあります。このようなクエリは複雑であるだけでなく、テスタビリティにも問題がありました。そのため、開発者がテストを実施することが困難になっており、クエリの変更を安心して行うことができない状態にありました。
本セッションでは、このような複雑な条件を持つBigQueryのSQLクエリに対して、Goのテストコードとして自動テストを作成した取り組みについてお話します。

The team charged with developing a management system for Merpay merchants deals with SQL queries for BigQuery that have a number of complex requirements. For instance, for calculation queries for such things as calculating costs related to merchant management, the requirements change periodically due to changes in the external environment. As a result, there are some queries for which it is difficult to systemize operations using such things as microservices. The complexity of these kinds of queries has not been the only difficulty we have encountered, either; there were also issues with testability. This made it cumbersome for developers to test their work and did not allow them to feel completely at ease with the query changes that they made.
In this session, we’ll talk about our initiative to create automatic tests as Go test code for working with SQL queries for BigQuery that have a number of complex requirements.

------
Merpay & Mercoin Tech Fest 2023は3日間のオンライン技術カンファレンスです。
IT企業で働くソフトウェアエンジニアおよびメルペイ・メルコインの技術スタックに興味がある方々を対象に2023年8月22日(火)、23日(水)、24日(木)の3日間、開催します。 Merpay & Mercoin Tech Fest は事業との関わりから技術への興味を深め、プロダクトやサービスを支えるエンジニアリングを知ることができるお祭りです。

今年のテーマは「Unleash Fintech」。 メルペイ・メルコインのこれまでの技術的な取り組みはもちろん、メルカリグループのFintech事業における新たな挑戦をお伝えします。 セッションでは事業を支える組織・技術・課題などへの試行錯誤やアプローチなど多面的にご紹介予定です。

メルペイ・メルコインが今後どのようにUnleash(解放)していくのか、ぜひ見に来てください。

■イベント関連情報
- 公式ウェブサイト:https://events.merpay.com/techfest-2023/
- 申し込みページ:https://mercari.connpass.com/event/286670/
- Twitterハッシュタグ: #MerpayMercoinTechFest
■リンク集
- メルカリ・メルペイイベント一覧:https://mercari.connpass.com/
- メルカリキャリアサイト:https://careers.mercari.com/
- メルカリエンジニアリングブログ:https://engineering.mercari.com/blog/
- メルカリエンジニア向けTwitterアカウント:https://twitter.com/mercaridevjp
- 株式会社メルペイ:https://jp.merpay.com/

mercari

October 14, 2023
Tweet

More Decks by mercari

Other Decks in Technology

Transcript

  1. 背景:クエリの複雑性 • 契約条項に基づく複雑な条件 ◦ (例) 審査通過日 、加盟店獲得後の決済情報、決済用QRコードの要否 • 複数のマイクロサービス・データベースへの依存 ◦

    業務ドメインで分割されているサービスを横断参照している ▪ (例) 申し込み、審査、事業者情報、決済、加盟店精算、決済用QR コード配送など • 最長で 600行の数十のクエリが存在している