from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import backref
from sqlalchemy.sql.sqltypes import BigInteger
import numpy as np

DB = SQLAlchemy()


class tracks(DB.Model):
    id = DB.Column(DB.BigInteger, primary_key=True)
    name = DB.Column(DB.String, nullable=False)
    artists = DB.Column(DB.String, nullable=False)
    release_year = DB.Column(DB.String, nullable=False)


class numbers(DB.Model):
    id = DB.Column(DB.Integer, primary_key=True)
    # track = DB.relationship('tracks', backref=DB.backref('numbers', lazy=True))
    # id = DB.Column(DB.BigInteger, DB.ForeignKey(tracks.id))
    popularity = DB.Column(DB.Float, nullable=False)
    duration_ms = DB.Column(DB.Float, nullable=False)
    explicit = DB.Column(DB.BigInteger, nullable=False)
    danceability = DB.Column(DB.Float, nullable=False)
    energy = DB.Column(DB.Float, nullable=False)
    key = DB.Column(DB.BigInteger, nullable=False)
    loudness = DB.Column(DB.Float, nullable=False)
    mode = DB.Column(DB.BigInteger, nullable=False)
    speechiness = DB.Column(DB.Float, nullable=False)
    acousticness = DB.Column(DB.Float, nullable=False)
    instrumentalness = DB.Column(DB.Float, nullable=False)
    liveness = DB.Column(DB.Float, nullable=False)
    valence = DB.Column(DB.Float, nullable=False)
    tempo = DB.Column(DB.Float, nullable=False)
    time_Signature = DB.Column(DB.BigInteger, nullable=False)
    release_year_norm = DB.Column(DB.Float, nullable=False)


    def __repr__(self):
        return np.array([[self.popularity, self.duration_ms, self.explicit,
        self.danceability, self.energy, self.key, self.loudness, self.mode,
        self.speechiness, self.acousticness, self.instrumentalness, self.liveness,
        self.valence, self.tempo, self.time_Signature, self.release_year_norm]])

from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import backref
from sqlalchemy.sql.sqltypes import BigInteger
import numpy as np

DB = SQLAlchemy()


class tracks(DB.Model):
    id = DB.Column(DB.BigInteger, primary_key=True)
    name = DB.Column(DB.String, nullable=False)
    artists = DB.Column(DB.String, nullable=False)
    release_year = DB.Column(DB.String, nullable=False)


class numbers(DB.Model):
    id = DB.Column(DB.Integer, primary_key=True)
    # track = DB.relationship('tracks', backref=DB.backref('numbers', lazy=True))
    # id = DB.Column(DB.BigInteger, DB.ForeignKey(tracks.id))
    popularity = DB.Column(DB.Float, nullable=False)
    duration_ms = DB.Column(DB.Float, nullable=False)
    explicit = DB.Column(DB.BigInteger, nullable=False)
    danceability = DB.Column(DB.Float, nullable=False)
    energy = DB.Column(DB.Float, nullable=False)
    key = DB.Column(DB.BigInteger, nullable=False)
    loudness = DB.Column(DB.Float, nullable=False)
    mode = DB.Column(DB.BigInteger, nullable=False)
    speechiness = DB.Column(DB.Float, nullable=False)
    acousticness = DB.Column(DB.Float, nullable=False)
    instrumentalness = DB.Column(DB.Float, nullable=False)
    liveness = DB.Column(DB.Float, nullable=False)
    valence = DB.Column(DB.Float, nullable=False)
    tempo = DB.Column(DB.Float, nullable=False)
    time_Signature = DB.Column(DB.BigInteger, nullable=False)
    release_year_norm = DB.Column(DB.Float, nullable=False)


    def __repr__(self):
        return np.array([[self.popularity, self.duration_ms, self.explicit,
        self.danceability, self.energy, self.key, self.loudness, self.mode,
        self.speechiness, self.acousticness, self.instrumentalness, self.liveness,
        self.valence, self.tempo, self.time_Signature, self.release_year_norm]])

# track = DB.relationship('tracks', backref=DB.backref('numbers', lazy=True)) # id = DB.Column(DB.BigInteger, DB.ForeignKey(tracks.id))