--- pretty_name: Spotify metadata and audio features in lossless Parquet tags: - spotify - music - metadata - audio-features - parquet - duckdb configs: - config_name: tracks_ranking data_files: - split: train path: spotify_tracks_ranking/tracks_ranking/part-*.parquet - config_name: track_audio_features data_files: - split: train path: spotify_clean_audio_features/track_audio_features/part-*.parquet - config_name: track_files data_files: - split: train path: spotify_clean_track_files/track_files/part-*.parquet - config_name: albums data_files: - split: train path: spotify_clean/albums/part-*.parquet - config_name: artists data_files: - split: train path: spotify_clean/artists/part-*.parquet - config_name: tracks data_files: - split: train path: spotify_clean/tracks/part-*.parquet default: true - config_name: album_images data_files: - split: train path: spotify_clean/album_images/part-*.parquet - config_name: artist_images data_files: - split: train path: spotify_clean/artist_images/part-*.parquet - config_name: artist_genres data_files: - split: train path: spotify_clean/artist_genres/part-*.parquet - config_name: artist_albums data_files: - split: train path: spotify_clean/artist_albums/part-*.parquet - config_name: track_artists data_files: - split: train path: spotify_clean/track_artists/part-*.parquet - config_name: available_markets data_files: - split: train path: spotify_clean/available_markets/part-*.parquet - config_name: new_table_name data_files: - split: train path: spotify_clean/new_table_name/part-*.parquet --- # Spotify metadata and audio features This is a lossless Parquet export of four supplied Spotify SQLite databases. It retains all 13 tables and all original columns. It includes track, artist, album, genre, popularity, file metadata, and audio measurements. **Storage:** 67.08 GiB in 9,659 Zstd-compressed Parquet files, compared with 278.65 GiB of SQLite source files. This reduces file size by 75.93%. The tables contain 1,762,433,614 rows in total. That total includes relationship rows and derived tables, not unique songs. The repository includes the conversion, validation, query, audit, benchmark, packaging, and upload code. It also includes the supplied PowerShell, Python, SQL, and notebooks. See the [code guide](code/README.md). ## Tables Each table has its own Hugging Face configuration. `tracks` is the default. The `train` split contains the full table. It is not a curated training split. | Table | Rows | Original columns | Parquet GiB | |---|---:|---:|---:| | `tracks_ranking` | 256,039,007 | 8 | 5.3705 | | `track_audio_features` | 255,594,909 | 17 | 9.0907 | | `track_files` | 255,966,403 | 27 | 32.3770 | | `albums` | 58,590,982 | 15 | 2.8377 | | `artists` | 15,430,442 | 6 | 0.4035 | | `tracks` | 256,039,007 | 13 | 13.3302 | | `album_images` | 175,809,992 | 4 | 1.4521 | | `artist_images` | 26,777,840 | 4 | 0.2402 | | `artist_genres` | 2,229,947 | 2 | 0.0094 | | `artist_albums` | 111,808,828 | 5 | 0.5943 | | `track_artists` | 348,055,756 | 2 | 1.3705 | | `available_markets` | 89,501 | 2 | 0.0020 | | `new_table_name` | 1,000 | 11 | 0.0000 | Each exported table also contains `__sqlite_rowid`. This retains the internal SQLite row number, including for tables without an explicit row ID column. The query helper hides that added column. Original `rowid` columns remain. The schema and original index definitions are in [manifest.json](manifest.json). SQLite index structures are not copied into Parquet. ## Audio measurements and audio files `track_audio_features` retains tempo, energy, danceability, loudness, speechiness, acousticness, instrumentalness, liveness, valence, key, mode, time signature, and duration. Measurements use float64 where needed. No measurements are rounded. Missing values remain NULL. These databases contain metadata, not full-song audio recordings. Image fields contain URLs. Spotify file IDs identify files but do not contain them. The `prefixed_ogg_packet` field contains a short binary prefix. ## Stream a table Install `datasets` separately to use this optional loading method: ```bash python -m pip install datasets ``` ```python from datasets import load_dataset rows = load_dataset( "alpha31476/spotify-metadata-parquet", name="track_audio_features", split="train", streaming=True, ) print(next(iter(rows))) ``` Select `tracks`, `artists`, `albums`, or any table name listed above as `name`. Streaming avoids downloading the full repository first. ## Query a local copy Use Python 3.11 or later. Install the core dependencies from the repository: ```bash python -m pip install -r requirements.txt python query_spotify.py --sql "SELECT rowid, name, popularity FROM tracks LIMIT 10" python query_spotify.py --sql "SELECT tempo, energy, danceability FROM track_audio_features LIMIT 10" ``` The helper creates DuckDB views over the Parquet files. It does not import all rows into another database. The [example queries](code/example_queries.sql) show album, artist, genre, and audio-feature joins. Large joins can still need time, memory, and temporary disk space. ## Validation During conversion, every part was read back and compared with its source Arrow values. Floating-point measurements were compared by their binary representation. NULL positions, binary values, source row counts, and source file identities were checked. The final check confirmed all table counts, schemas, part sizes, NULL statistics, row ID ranges, and Zstd compression. See [validation.json](validation.json). [release_inventory.json](release_inventory.json) records SHA256 checksums for the staged files. It excludes itself and local runtime files. The portable export code was also tested on two real rows from each of the 13 source tables. See [release_checks.json](release_checks.json). ```bash python verify_export.py python upload_dataset.py --verify-hashes ``` The first command checks Parquet metadata. The second reads all files to check their checksums. Neither command uploads data. ## Reproduce or publish The original SQLite files are inputs to the export tool. They are not included in this repository. The exporter opens them read-only. See the [code guide](code/README.md) for the full commands and dependency notes. The uploader runs a local check by default. Publication requires `--publish`. It uses the normal Hugging Face login. No token is stored in this repository. Interrupted uploads can be resumed with `--publish --resume` on the same prepared release. Local upload cache and state files are excluded. ## Source and limits The supplied source files are `spotify_clean.sqlite3`, `spotify_clean_audio_features.sqlite3`, `spotify_clean_track_files.sqlite3`, and `spotify_tracks_ranking.sqlite3`. Source table counts and sample rows are included under [metadata](metadata). `tracks_ranking` is a derived ranking table. `new_table_name` is a local derived sample of 1,000 rows. These are retained to preserve the supplied databases. They are not independent sets of source songs. Popularity and availability are historical snapshots. They are not current Spotify values. Missing data remain missing. Spotify IDs and archive paths do not establish that the matching audio files are present. ## License No explicit redistribution license was supplied with the local source files. No new data license is assigned by this conversion. See [LICENSE-NOTICE.txt](LICENSE-NOTICE.txt). The format change does not grant new rights over upstream content.