> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# format_schema_* のフォーマット設定

> format_schema_* 生成グループ内の ClickHouse のフォーマット設定。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["バージョン", "デフォルト値", "コメント"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        バージョン履歴
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>デフォルト値</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          再起動せずに変更可能
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

これらの設定は、[ソース](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/FormatFactorySettings.h) から自動生成されています。

<div id="format_schema">
  ## format\_schema
</div>

このパラメーターは、[Cap'n Proto](https://capnproto.org/) や [Protobuf](https://developers.google.com/protocol-buffers/) のような、スキーマ定義を必要とするフォーマットを使用する場合に便利です。値はフォーマットによって異なります。

<div id="format_schema_message_name">
  ## format\_schema\_message\_name
</div>

`format_schema` で定義されたスキーマ内で必要なメッセージ名を指定します。
従来の format\_schema 形式 (`file_name:message_name`) との互換性を維持するため、次のように動作します。

* `format_schema_message_name` が指定されていない場合、メッセージ名は従来の `format_schema` 値の `message_name` 部分から推論されます。
* 従来形式の使用時に `format_schema_message_name` を指定すると、エラーになります。

<div id="format_schema_source">
  ## format\_schema\_source
</div>

<SettingsInfoBlock type="String" default_value="file" />

`format_schema` のソースを定義します。
設定可能な値:

* 'file' (デフォルト) : `format_schema` は、`format_schemas` ディレクトリに配置されたスキーマファイルの名前です。
* 'string': `format_schema` は、スキーマの内容そのものをリテラルとして指定します。
* 'query': `format_schema` は、スキーマを取得するためのクエリです。
  `format_schema_source` を 'query' に設定した場合、次の条件が適用されます:
* クエリは必ず 1 つの値、つまり単一の文字列カラムを持つ 1 行だけを返さなければなりません。
* クエリの結果は、スキーマの内容として扱われます。
* この結果は、`format_schemas` ディレクトリにローカルにキャッシュされます。
* 次のコマンドを使用してローカル cache をクリアできます: `SYSTEM DROP FORMAT SCHEMA CACHE FOR Files`。
* 一度キャッシュされると、cache が明示的にクリアされるまで、同一のクエリがスキーマ取得のために再実行されることはありません
* ローカルの cache ファイルに加えて、Protobuf メッセージもメモリ内にキャッシュされます。ローカルの cache ファイルをクリアした後でも、スキーマを完全に更新するには、`SYSTEM DROP FORMAT SCHEMA CACHE [FOR Protobuf]` を使用して in-memory cache をクリアする必要があります。
* `SYSTEM DROP FORMAT SCHEMA CACHE` クエリを実行すると、cache ファイルと Protobuf メッセージのスキーマの両方の cache を一度にクリアできます。
