<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kazukifu</author_name>
  <author_url>https://blog.hatena.ne.jp/kazukifu/</author_url>
  <blog_title>Kazuki's Blog</blog_title>
  <blog_url>https://kazukifu.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>はじめに PythonでSQLiteやその他のDBを扱う際、SQL文を文字列としてスクリプト内に書くことはよくあります。しかし「1行に全部書いてしまう」「トリプルクォートを使ったらインデントが混入した」といった問題に直面した経験がある方も多いのではないでしょうか。 本記事では、sqlite3 を題材にしつつ、flake8/pylintに準拠しながら可読性の高いSQL文字列を書くベストプラクティスを紹介します。 1. 現状コードの問題点 例1：CREATE TABLE with sqlite3.connect(DB_PATH) as conn: conn.execute('''CREATE TA…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkazukifu.hatenablog.com%2Fentry%2F2026%2F03%2F22%2F124850&quot; title=&quot;tkinterを利用してカレンダーWidgetと予定・実績管理Widgetを統合する(番外編3 SQL文編：スクリプト内のSQL文字列の書き方の改善) - Kazuki&amp;#39;s Blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2026-03-22 12:48:50</published>
  <title>tkinterを利用してカレンダーWidgetと予定・実績管理Widgetを統合する(番外編3 SQL文編：スクリプト内のSQL文字列の書き方の改善)</title>
  <type>rich</type>
  <url>https://kazukifu.hatenablog.com/entry/2026/03/22/124850</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
