file in abyss
フォーマット一覧へ戻る

Database

SQLITE SQLite Database

単一ファイルで完結するリレーショナルデータベース。先頭に16バイトの識別文字列があります。

Extensions .sqlite, .sqlite3, .db
MIME application/vnd.sqlite3

マジックナンバー

ファイルを解析
オフセット 0 SQLite database header
53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00
SQLite format 3.

構造

  1. Database header
  2. Page 1 b-tree
  3. Additional pages
  4. Freelist pages

注意点

  • 拡張子.dbは多用途なので、拡張子だけではSQLiteと判断できません。

判定コード例

SIGNATURE = bytes.fromhex("53514c69746520666f726d6174203300")
OFFSET = 0

def is_sqlite(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

SQLite Database はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。

よくある判定ミス

  • .sqlite / .sqlite3 / .db という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • SQLite Database は 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。

サンプルの活用

11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
DB

Empty SQLite Database

Empty SQLite Database is a SQLite Database sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

empty.sqlite
Type Sample
8.0 KB
Generated CC0 1.0
SHA-256 b7f7e548f85dee3d852f6f93e10a255c89e2794d377b76609ce85983855f8a7e
Download
DB

Blue Sky SQLITE

Blue Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.sqlite
Type Sample
8.0 KB
SHA-256 de49b67e2d35c5fd8ac1ce47d430c5f462d1f07316e092933d1955f13de7fd3f
Download
DB

Flower Garden SQLITE

Flower Garden SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.sqlite
Type Sample
16 KB
SHA-256 8809e67a69e609d885d109df795d541c49a256abebeadccf6794c4151f5d3070
Download
DB

Navy Blue Sky SQLITE

Navy Blue Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.sqlite
Type Sample
24 KB
SHA-256 08ae8fc7f0d91d2dda5d6dfd1f759168d05caed61b2ce0620cf4a0b0249e2d0e
Download
DB

Nature of the Sky SQLITE

Nature of the Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.sqlite
Type Sample
32 KB
SHA-256 778f053503b486a52c4bcf9a1a6cee74e233866961ac6ab03351ed9b6dcd6149
Download
DB

Sky Landscape SQLITE

Sky Landscape SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.sqlite
Type Sample
40 KB
SHA-256 3deb27219fedc47feeb97b2617a7f348aad2cad5066bd3ee8fe7b10bfa8fc6be
Download
DB

Starry Sky SQLITE

Starry Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.sqlite
Type Sample
48 KB
SHA-256 d9319a9126f7828c9d3e08acb49b87b289a34cff30c2e74cd61add5b65db72a9
Download
DB

Blue Night Sky SQLITE

Blue Night Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.sqlite
Type Sample
56 KB
SHA-256 6cdf3497c3ad14acd2a0b0d133ddfbbbd9ae59372112b5949be35c348114d760
Download
DB

Hibiscus Flower SQLITE

Hibiscus Flower SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.sqlite
Type Sample
64 KB
SHA-256 51f07ec19ac5e239e3f82a601bd65a89e0b971c584b9f5e8b62088c84092a2fb
Download
DB

Arctic Sky SQLITE

Arctic Sky SQLITE is a SQLite Database sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.sqlite
Type Sample
72 KB
SHA-256 040cdcac8bc3b0df0ac4e90155ce7d170a9f7abfa0e2528dce0cd631dbfb97cd
Download
DB

NASA Blue Marble SQLITE

NASA Blue Marble SQLITE is a SQLite Database sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.sqlite
Type Sample
88 KB
SHA-256 db6f2b0c850281a93c68e813096391ff9d879894b07cff9f39487c8b5aced8f4
Download

よくある質問

SQLite Database のマジックナンバー(ファイルシグネチャ)は?

SQLite Database ファイルはバイトシグネチャ 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 ("SQLite format 3.") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

SQLite Database のMIMEタイプは?

SQLite Database のMIMEタイプは application/vnd.sqlite3 です。

SQLite Database の拡張子は?

SQLite Database ファイルは .sqlite, .sqlite3, .db 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。