"""Models for tables related to Sony.""" from sqlalchemy import Column, Integer, String from apollo_main_db.base import Base class SonyRelease(Base): """Sony Track Release. Attributes: isrc: International Standard Recording Code. This code is a unique identifier of a recording, but NOT of a track. The same recording can be released multiple times as tracks in different albums. Different tracks can share the same ISRC. country: Country code. To reduce number of different names for 2-char code here used 'country' but it named 'Region' in DB table. """ __tablename__ = 'tblSonyRelease' isrc = Column('ISRC', String(15), primary_key=True) country = Column('Region', String(2), primary_key=True) def __str__(self) -> str: return 'Sony Track Release {}'.format(self.isrc) class SonyUPCRegion(Base): """Sony UPC region release info. Attributes: upc: Universal Product Code of an album. country: Country code. To reduce number of different names for 2-char code here used 'country' but it named 'Region' in DB table. music_service_id: Vendor type (1 - Spotify, 6 - Apple music). release_type_id: Release account (1 - Sony, 2 - Orchard, etc) """ __tablename__ = 'tblSonyUPCRegion' upc = Column('UPC', String(50), primary_key=True) country = Column('Region', String(2), primary_key=True) music_service_id = Column('MusicServiceId', Integer, primary_key=True) release_type_id = Column('ReleaseTypeId', Integer, primary_key=True) def __str__(self) -> str: return 'Sony UPC {} Region {} Service {} Release type {}'.format( self.upc, self.country, self.music_service_id, self.release_type_id)