Find all recordings of a set of artists and problem with l_artist_recording relation

Tags: #<Tag:0x00007f7cfce3a230> #<Tag:0x00007f7cfce39f88>

Hi all,

I want to extract all recordings of several specific artist. For that I loaded the musicbrainz database on a local postgresql instance using mbdata (https://github.com/lalinsky/mbdata).

I tried the following command but it did not work :

select artist.name, recording.name from recording, l_artist_recording, artist where recording.id=l_artist_recording.entity1 AND artist.id=l_artist_recording.entity0 and artist.name=‘Nekfeu’;

Indeed, I noticed that the number of rows in the table recordings is different than in l_artist_recording. So this mean that we do not have the information of the artist for all recordings right ?

Do someone know why this is the case ? Or maybe I did not understand correctly the database schema ? Do you know how I can answer my question ?

Thank you

I assume you want recordings “credited to” several specific artists, you should then use the tables artist_credit and artist_credit_name, see database schema, instead of l_artist_recording which is for more specific relationship types only.

For example:

SELECT recording.name, ac.name
FROM recording
JOIN artist_credit ac ON ac.id = recording.artist_credit
JOIN artist_credit_name acn ON acn.artist_credit = ac.id
JOIN artist ON artist.id = acn.artist
WHERE artist.name = 'Nekfeu'
ORDER BY recording.name, ac.name;
3 Likes

Oh ok I had not understood l_artist_recording correctly. Your command works thanks !