File size: 2,872 Bytes
b20aa16
 
9876f72
 
 
bd0242f
 
 
 
 
9876f72
 
bd0242f
 
 
 
 
 
ed54a2e
 
 
 
 
b20aa16
9876f72
974865b
9876f72
 
74d49d0
b361dfb
5e62f71
9876f72
 
5e62f71
81fb9bf
 
974865b
 
 
 
 
 
 
 
 
 
221d292
974865b
 
fa044a3
33c0ee8
974865b
33c0ee8
 
 
974865b
33c0ee8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
974865b
5e62f71
 
862f844
33c0ee8
862f844
9801434
33c0ee8
974865b
33c0ee8
 
 
 
 
974865b
 
33c0ee8
 
974865b
bd0242f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
license: mit
task_categories:
- image-classification
- text-to-image
- image-to-text
- image-to-image
- text-retrieval
- text-generation
- text-classification
language:
- en
- ja
tags:
- art
- anime
size_categories:
- 1M<n<10M
configs:
- config_name: default
  data_files:
  - split: train
    path: "parquet/post.parquet"
---
# Metadata Database for Danbooru2023

Danbooru 2023 datasets: https://huggingface.co/datasets/nyanko7/danbooru2023

The latest entry of this database is id 7,866,491. Which is newer than nyanko7's dataset.

This dataset contains a sqlite db file which have all the tags and posts metadata in it.<br>
The Peewee ORM config file is provided too, plz check it for more information. (Especially on how I link posts and tags together)

The original data is from the official dump of the posts info.<br>
Check this [link](https://console.cloud.google.com/storage/browser/danbooru_public/data) for more info.

## Format

This dataset contains 3 format but they store same contents:

* Sqlite (.db)
  * have 2 versions: with/without index.
* Parquet
  * Parquet files' name indicate the sqlite/duckdb table name.
  * It is recommended to use post.parquet when you need to export tons of content.
* Duckdb (.duckdb)
  * have 2 versions: with/without index.

`others` folder will contains some pre-exported files like tags for each post.

## Details

This section contains some details that you need to be aware of if you want to use other ORM system or use plain SQL query to utilize this database.

#### Custom Enum Fields

Some fields in Post/Tags use my custom enum field to store type/category or something like that:

* Post.rating
  * 0: general
  * 1: sensitive
  * 2: questionable
  * 3: explicit
* Tag.type
  * 0: general
  * 1: artist
  * 2: character
  * 3: copyright
  * 4: meta

#### Tag List

I use peewee ManyToManyField to implement the Tag List things. Which utilize a through model which have all the pair of Tag and Post<br>
Since it is very likely we will want to use Tag to query posts, so many-to-many is better.<br>
The con of this design is the database file will be 1.5x larger than before(we have 0.25B entries for the post-tag pairs), but the query speed become 2~3x faster, so I think it is acceptable.

After done some checking, I can ensure that all the "categorical tag list" can be done by full list + filter, and that is how I done it now. Check the db.py for more details.

#### Utils

if you think above details are too complicated, just use the db_utils.py and other PeeWee API to utilize this database.
I also provide a write_csv.py for exporting whole dataset into csv for data analysis.

## License

The database files of this repo are licensed under MiT License.<br>
The source code files of this repo are licensed under Apache 2.0 License.

## Acknowledgement

Thx for AngelBottomless for updating new entries