Getting dates of recordings, releases, release groups from DB dumps

Hi,
I download the MB data dumps and deployed on a Postgres DB, and I’m trying to reverse-engineer my way through.
I’m trying to find the first release of a work, e.g. Song “Sultans of Swing” - MusicBrainz. I can see a list of recordings, and found the relation table between work and recording, but I cannot find in the DB dump the “date” of the recording.
Can anyone point me to the right DB table that contains this information?

Thanks for the help.

Oren

There’s no “recording date” as such, dates are always set on specific relationships (e.g. artist-recording or recording-work) so you have to look at the l_recording_work and link tables.

If you are starting looking at the MB DB schema, I encourage you to look at the doc and source code for Reports where you can find full queries examples (musicbrainz-server or - shameless plug - my own)

2 Likes

Hi Loujin,

Thanks for this information, this is very helpful.

Let me be more specific about my request. Using last.fm API, I’m getting an mbid for top tracks. As it turns out, this mbid is the recording id in MusicBrainz of one of the song’s recordings.
My goal is to get the year in which the song was first released, so I’m trying to find the earliest “Release” entity in MusicBrainz for that song (given the recording ID).

I need to use the “work” entity related to the recording ID since sometimes the recording ID used in last.fm is for a later recording, so indeed I’m using l_recording_work to extract all works releated to this recording.

And this is where I’m stuck, I’m trying to find a relation from either “work” or “recording” entities to the “release” entity. I noticed that I can use the “track” and “medium” entities to link from a “recording” to a “release”, but is there a simpler way to get the first release date of the song, based on the recording ID?

Thanks for the assistance,

Oren

Would using the MB API work for you?

https://musicbrainz.org/ws/2/recording/7ac3be22-90b5-4245-995f-f3d2709d750a?fmt=json

This gives:

{
    "video": false,
    "title": "Prelude to the Afternoon of a Faun",
    "id": "7ac3be22-90b5-4245-995f-f3d2709d750a",
    "length": 617000,
    "first-release-date": "1976",
    "disambiguation": ""
}

where first-release-date is actually what you are describing: the very first date for a release on which this recording was included.

1 Like

When or how is the first-release-date filled? For almost all cases I’ve seen it works as expected, but the following recording doesn’t include that field:

https://musicbrainz.org/ws/2/recording/8f98931b-4959-4a7e-a7f0-505d389bb7fa

Even though it’s part of a release with a known date:

https://musicbrainz.org/recording/8f98931b-4959-4a7e-a7f0-505d389bb7fa

1 Like