Ejemplo n.º 1
0
class DownloadState(db.Model):
    __tablename__ = "download_state"
    idx = db.Column(db.Integer(), primary_key=True)
    url = db.Column(db.String(255), unique=True)
    number_of_images = db.Column(db.Integer())
    downloading_image = db.Column(db.Integer(), default=0)
    slide = db.ForeignKey("Slide")
Ejemplo n.º 2
0
class Level(db.Model):
    __tablename__ = 'levels'
    __table_args__ = (db.UniqueConstraint('number', name='levels_number_uc'), )

    id = db.Column(db.BigInteger, primary_key=True)
    title = db.Column(db.String(length=255), nullable=False)
    number = db.Column(db.Integer(), nullable=False)
    description = db.Column(db.Text, nullable=False)
    required_points = db.Column(db.Integer(), default=0, nullable=False)
    offered_gems = db.Column(db.Integer(), default=0, nullable=False)
    points_per_win = db.Column(db.Integer(), default=0)
    image = db.Column(db.Text, nullable=False)

    users = db.relationship("User")
    auctions = db.relationship("Auction")

    created = db.Column(db.TIMESTAMP,
                        default=datetime.datetime.now,
                        nullable=False)
    updated = db.Column(db.TIMESTAMP,
                        default=datetime.datetime.now,
                        nullable=False,
                        onupdate=datetime.datetime.now)

    def __str__(self):
        return self.title + " شامل " + str(self.required_points) + " امتیاز "
Ejemplo n.º 3
0
class Serata(db.Model):

    __tablename__ = "serata"

    __table_args__ = (db.UniqueConstraint("id",
                                          "data",
                                          name="contraint_serata"), )

    id = db.Column(db.Integer(), primary_key=True)
    nome = db.Column(db.String(255), nullable=False)
    descrizione = db.Column(db.String(255), nullable=False)
    data = db.Column(db.DateTime(), nullable=False)
    link_partecipazione = db.Column(db.String(255), nullable=True)
    link_registrazione = db.Column(db.String(255), nullable=True)

    corso_id = db.Column(db.Integer(), db.ForeignKey("corso.id"))

    def __init__(self,
                 nome,
                 descrizione,
                 data,
                 link_partecipazione='',
                 link_registrazione=''):
        self.nome = nome
        self.descrizione = descrizione
        self.data = data
        self.link_partecipazione = link_partecipazione
        self.link_registrazione = link_registrazione

    def __repr__(self):
        return "<Descrizione '{}'. Link registrazione>".format(
            self.descrizione, self.link_registrazione)
Ejemplo n.º 4
0
class Destination(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    code = db.Column(db.String())
    institutional_name = db.Column(db.String(), nullable=False)
    faculty = db.Column(db.String(), nullable=False)
    seats_available = db.Column(db.Integer())

    def reduce_seats(self):
        self.seats_available -= 1
Ejemplo n.º 5
0
class Station(db.Model):
    __tablename__ = "stations"
    # id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    # here id will be the station_id, so no auto-incrememnt
    id = db.Column(db.Integer(), primary_key=True, nullable=False)
    station_name = db.Column(db.String(128), nullable=True)
    available_docks = db.Column(db.Integer(), nullable=True)
    total_docks = db.Column(db.Integer(), nullable=True)
    latitude = db.Column(db.Float(), nullable=True)
    longitude = db.Column(db.Float(), nullable=True)
    status_value = db.Column(db.String(128), nullable=True)
    status_key = db.Column(db.Integer(), nullable=True)
    available_bikes = db.Column(db.Integer(), nullable=True)
    st_address_1 = db.Column(db.String(128), nullable=True)
    st_address_2 = db.Column(db.String(128), nullable=True)
    city = db.Column(db.String(128), nullable=True)
    postal_code = db.Column(db.String(128), nullable=True)
    location = db.Column(db.String(128), nullable=True)
    altitude = db.Column(db.String(128), nullable=True)
    land_mark = db.Column(db.String(128), nullable=True)
    test_station = db.Column(db.Boolean(), nullable=True)
    last_communication_time = db.Column(db.String(128), nullable=True)

    def __init__(self, id, station_name, available_docks, total_docks,
                 latitude, longitude, status_value, status_key,
                 available_bikes, st_address_1, st_address_2, city,
                 postal_code, location, altitude, land_mark, test_station,
                 last_communication_time):
        self.id = id
        self.station_name = station_name
        self.available_docks = available_docks
        self.total_docks = total_docks
        self.latitude = latitude
        self.longitude = longitude
        self.status_value = status_value
        self.status_key = status_key
        self.available_bikes = available_bikes
        self.st_address_1 = st_address_1
        self.st_address_2 = st_address_2
        self.city = city
        self.postal_code = postal_code
        self.location = location
        self.altitude = altitude
        self.land_mark = land_mark
        self.test_station = test_station
        self.last_communication_time = last_communication_time

    def from_dict(self, data):
        for field in [
                'station_name', 'available_docks', 'total_docks', 'latitude',
                'longitude', 'status_value', 'status_key', 'available_bikes',
                'st_address_1', 'st_address_2', 'city', 'postal_code',
                'location', 'altitude', 'land_mark', 'test_station',
                'last_communication_time'
        ]:
            if field in data:
                setattr(self, field, data[field])
Ejemplo n.º 6
0
class UserRoles(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('user.id', ondelete='CASCADE'))
    role_id = db.Column(db.Integer(),
                        db.ForeignKey('roles.id', ondelete='CASCADE'))

    # print method
    def __repr__(self):
        return f"UserRoles('{self.user_id}', '{self.role_id}')"
Ejemplo n.º 7
0
class SongMeta(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    spotify_url = db.Column(db.String(200))
    suggested_by = db.Column(db.String(64))
    last_played = db.Column(db.Integer(), default=0)
    num_votes = db.Column(db.Integer(), default=0)
    list_id = db.Column(db.Integer, db.ForeignKey('list.id'))

    def __repr__(self):
        return '<Song {}>'.format(self.spotify_url)
Ejemplo n.º 8
0
class BooksUsers(db.Model):
    __tablename__ = 'books_users'
    id = db.Column(db.Integer(), primary_key=True)
    bookmarked_id = db.Column(db.Integer())
    user_id = db.Column(db.Integer())

    def __init__(self, bookmarked_id, user_id):
        self.bookmarked_id = bookmarked_id
        self.user_id = user_id

    def __repr__(self):
        return '<User Id %r>' % self.user_id
Ejemplo n.º 9
0
class StationHistory(db.Model):
    __tablename__ = "station_histories"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    station_id = db.Column(db.Integer(),
                           db.ForeignKey("stations.id", ondelete="CASCADE"),
                           nullable=False)
    station = db.relationship('Station',
                              backref=db.backref('station_histories',
                                                 passive_deletes=True))

    station_name = db.Column(db.String(128), nullable=True)
    available_docks = db.Column(db.Integer(), nullable=True)
    total_docks = db.Column(db.Integer(), nullable=True)
    latitude = db.Column(db.Float(), nullable=True)
    longitude = db.Column(db.Float(), nullable=True)
    status_value = db.Column(db.String(128), nullable=True)
    status_key = db.Column(db.Integer(), nullable=True)
    available_bikes = db.Column(db.Integer(), nullable=True)
    st_address_1 = db.Column(db.String(128), nullable=True)
    st_address_2 = db.Column(db.String(128), nullable=True)
    city = db.Column(db.String(128), nullable=True)
    postal_code = db.Column(db.String(128), nullable=True)
    location = db.Column(db.String(128), nullable=True)
    altitude = db.Column(db.String(128), nullable=True)
    land_mark = db.Column(db.String(128), nullable=True)
    test_station = db.Column(db.Boolean(), nullable=True)
    last_communication_time = db.Column(db.String(128), nullable=True)

    def __init__(self, station_id, station_name, available_docks, total_docks,
                 latitude, longitude, status_value, status_key,
                 available_bikes, st_address_1, st_address_2, city,
                 postal_code, location, altitude, land_mark, test_station,
                 last_communication_time):
        self.station_id = station_id
        self.station_name = station_name
        self.available_docks = available_docks
        self.total_docks = total_docks
        self.latitude = latitude
        self.longitude = longitude
        self.status_value = status_value
        self.status_key = status_key
        self.available_bikes = available_bikes
        self.st_address_1 = st_address_1
        self.st_address_2 = st_address_2
        self.city = city
        self.postal_code = postal_code
        self.location = location
        self.altitude = altitude
        self.land_mark = land_mark
        self.test_station = test_station
        self.last_communication_time = last_communication_time
Ejemplo n.º 10
0
class Books(db.Model):
    __tablename__ = 'books'
    book_id = db.Column(db.Integer(), primary_key=True)
    title = db.Column(db.String(500), unique=True)
    length = db.Column(db.Integer())
    photo = db.Column(db.String(100))
    isbn = db.Column(db.String(50))

    def __init__(self, title, length):
        self.title = title
        self.length = length

    def __repr__(self):
        return '<Book %r>' % self.title
Ejemplo n.º 11
0
class UsersBooksRatings(db.Model):
    __tablename__ = 'users_books_ratings'
    id = db.Column(db.Integer(), primary_key=True)
    book_id = db.Column(db.Integer())
    user_id = db.Column(db.Integer())
    rating = db.Column(db.Integer())

    def __init__(self, user_id, book_id, rating):
        self.rating = rating
        self.book_id = book_id
        self.user_id = user_id

    def __repr__(self):
        return '<User Book Rate %r>' % self.rating
Ejemplo n.º 12
0
class Corso(db.Model):
    # Nome della tabella
    __tablename__ = "corso"

    # Struttura/Attributi
    id = db.Column(db.Integer(), primary_key=True)
    nome = db.Column(db.String(100), unique=True, nullable=False)
    insegnante = db.Column(db.String(100))
    lezioni = db.Column(db.Integer())
    livello = db.Column(db.String(100))
    descrizione = db.Column(db.String(255))

    # Relazione 1:n; ordinamento serate per data
    serate = db.relationship("Serata",
                             order_by="asc(Serata.data)",
                             backref="corso",
                             lazy="subquery")

    # Relazione n:n
    tags = db.relationship(
        "Tag",
        secondary=tags,
        lazy="subquery",
        backref=db.backref("corso", lazy=True),
    )

    # Costruttore

    # NOTA: Lasciare il costruttore crea problemi nella gestione della form di creazione
    def __init__(self, nome, insegnante, lezioni, livello, descrizione):
        self.nome = nome
        self.insegnante = insegnante
        self.lezioni = lezioni
        self.livello = livello
        self.descrizione = descrizione
        # self.serate = serate
        # self.tags = tags

    # Visualize object corso informations
    def __repr__(self):
        return "\n{}: {} è tenuto da {}. Livello {}. Id {}. Tags {}".format(
            self.nome,
            self.descrizione,
            self.insegnante,
            self.livello,
            self.id,
            self.tags,
        )
Ejemplo n.º 13
0
class CoinPayment(db.Model):
    __tablename__ = 'coin_payments'
    id = db.Column(db.Integer, primary_key=True)
    GUID = db.Column(db.String(64), nullable=False)
    paid_coins = db.Column(db.Integer(), default=0, nullable=False)
    type = db.Column(db.String(64), default=CoinPayType.NOTITLE)
    status = db.Column(db.String(64), default=CoinPayStatus.WAIT)
    # sequence = db.Column(db.String(255), nullable=False,default=CoinPayStatus.WAIT)

    user_id = db.Column(db.BigInteger, db.ForeignKey('users.id'))
    user = db.relationship('User')

    created = db.Column(db.TIMESTAMP, default=datetime.now, nullable=False)
    updated = db.Column(db.TIMESTAMP,
                        default=datetime.now,
                        nullable=False,
                        onupdate=datetime.now)

    def __str__(self):
        return " پرداخت با سکه " + str(self.GUID) + " باوضعیت  :" + str(
            self.status) + " در تاریخ : " + str(self.created)

    def __init__(self):
        random.seed(datetime.now())
        self.GUID = random.randint(100000000000, 10000000000000000)
class Bovine(db.Model):
    bovine_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    name = db.Column(db.String(150), nullable=True)
    date_of_birth = db.Column(db.String(15), nullable=False)
    breed = db.Column(db.String(25), nullable=True)
    actual_weight = db.Column(db.Numeric(7, 2), nullable=False)
    is_beef_cattle = db.Column(db.Boolean(), nullable=True)
    farm_id = db.Column(db.Integer, db.ForeignKey('farm.farm_id'))
    batch_of_beef = db.Column(db.Integer, nullable=True)

    __mapper_args__ = {'polymorphic_identity': 'bovine'}

    def init(self, farm_id, name, date_of_birth, breed, actual_weight,
             is_beef_cattle, batch_of_beef):
        self.farm_id = farm_id
        self.name = name
        self.breed = breed
        self.actual_weight = actual_weight
        self.date_of_birth = date_of_birth
        self.is_beef_cattle = is_beef_cattle
        self.batch_of_beef = batch_of_beef

    def to_json(self):
        return {
            'bovine_id': self.bovine_id,
            'farm_id': self.farm_id,
            'breed': self.breed,
            'actual_weight': float(self.actual_weight),
            'date_of_birth': str(self.date_of_birth),
            'is_beef_cattle': self.is_beef_cattle,
            'batch_of_beef': self.batch_of_beef
        }
Ejemplo n.º 15
0
class Log(db.Model):
    __tablename__ = 'log'
    log_id = db.Column(db.Integer(), primary_key=True)
    device_id = db.Column(db.Integer(), unique=False)
    book_id = db.Column(db.Integer(), unique=False)
    datetime = db.Column(db.DateTime())
    progress = db.Column(db.Float())

    def __init__(self, device_id, book_id, datetime, progress):
        self.device_id = device_id
        self.book_id = book_id
        self.datetime = datetime
        self.progress = progress

    def __repr__(self):
        return '<User %r>' % self.datetime
Ejemplo n.º 16
0
class Slide(db.Model):
    __tablename__ = "slide"
    idx = db.Column(db.Integer(), primary_key=True)
    slideshare_url = db.Column(db.String(255), unique=True)
    title = db.Column(db.String(64))
    author = db.Column(db.String(64))
    description = db.Column(db.String(255))
    thumbnail = db.Column(db.String(255))
    pdf_path = db.Column(db.String(255))
    views = db.Column(db.Integer, default=0)
    _hash = db.Column(db.String(32))

    def __init__(self, slideshare_url, thumbnail=None, pdf_path=None):
        self.slideshare_url = slideshare_url
        self.thumbnail = thumbnail
        self.pdf_path = pdf_path

    @staticmethod
    def get_or_create(url):
        instance = Slide.query.filter_by(slideshare_url=url).first()
        if instance:
            return instance, True
        s = Slide(url)
        db.session.add(s)
        db.session.commit()
        return s, False
Ejemplo n.º 17
0
class Tag(db.Model):

    __tablename__ = "tag"

    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(255), unique=True, nullable=False)

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return "<Tag '{}'>".format(self.name)

    '''
    Utile per il popolamento dei dati e per i test
    '''

    @staticmethod
    def insert_test_tags():
        tags = [
            "Python", "Flask", "Pygame", "SqlAlchemy", "Web Development",
            "Graphics", "NumPy", "Pandas", "Django"
        ]
        for name_tag in tags:
            tag = Tag.query.filter_by(name=name_tag).first()
            if tag is None:
                tag = Tag(name=name_tag)
            db.session.add(tag)
        db.session.commit()
Ejemplo n.º 18
0
class Product(db.Model):

    __tablename__ = 'products'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    nombre = db.Column(db.String(128), nullable=False)
    cantidad = db.Column(db.Integer(), nullable=False)
    precio = db.Column(db.Float(), nullable=False)
    descripcion = db.Column(db.String(128), nullable=False)
    categoria = db.Column(db.String(128), nullable=False)
    active = db.Column(db.Boolean(), default=True, nullable=False)

    def to_json(self):
        return {
            'id': self.id,
            'nombre': self.nombre,
            'cantidad': self.cantidad,
            'precio': self.precio,
            'descripcion': self.descripcion,
            'categoria': self.categoria,
            'active': self.active
        }

    def __init__(self, nombre, cantidad, precio, descripcion, categoria):
        self.nombre = nombre
        self.cantidad = cantidad
        self.precio = precio
        self.descripcion = descripcion
        self.categoria = categoria
Ejemplo n.º 19
0
class Users(db.Model):
    __tablename__ = 'users'
    user_id = db.Column(db.Integer(), primary_key=True)
    device_id = db.Column(db.Integer(), unique=False)
    name = db.Column(db.String(200))
    photo = db.Column(db.String(100))
    email = db.Column(db.String(100))
    password = db.Column(db.String(32))

    def __init__(self, device_id, name, photo, password):
        self.device_id = device_id
        self.name = name
        self.photo = photo
        self.password = password

    def __repr__(self):
        return '<User %r>' % self.name
Ejemplo n.º 20
0
class Role(db.Model, RoleMixin):
    __tablename__ = "role"
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(80), unique=True)
    description = db.Column(db.String(255))

    def __str__(self):
        return self.name
Ejemplo n.º 21
0
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50), unique=True)

    # print method
    def __repr__(self):
        return self.name
Ejemplo n.º 22
0
class alumni(db.Model):
    __tablename__ = 'tb_alumni'
    id = db.Column(db.Integer, primary_key=True)
    department = db.Column(db.String(64))  # 校友所属系
    name = db.Column(db.String(64))  # 校友名字
    company = db.Column(db.String(64))  # 校友公司
    type = db.Column(db.String(64), default=0)  # 捐赠类型
    money = db.Column(db.Integer())  # 捐赠金额
    time = db.Column(db.DateTime(), default=datetime.utcnow)
Ejemplo n.º 23
0
class Progress_comment(db.Model, UserMixin):
    __tablename__ = 'comment'
    id = db.Column(db.Integer(), primary_key=True)
    reg_no = db.Column(db.String(25))
    body = db.Column(db.String(3000))

    def __init__(self, reg_no, body):
        self.reg_no = reg_no
        self.body = body
Ejemplo n.º 24
0
class BlogPost(db.Model):
    id = db.Column(db.Integer())
    user_id = db.Column(db.ForeignKey("users.id"), nullable=False)
    title = db.Column(db.String(140), nullable=False)
    pub_date = db.Column(db.DATETIME(), default=datetime.utcnow , nullable=False)
    text = db.Column(db.TEXT(), nullable=False)

    def __repr__(self):
        return f"Post {self.title} "
Ejemplo n.º 25
0
class Serata(db.Model):

    __tablename__ = "serata"

    __table_args__ = (db.UniqueConstraint("id", "data", name="constraint_serata"),)

    id = db.Column(db.Integer(), primary_key=True)
    nome = db.Column(db.String(255), nullable=False)
    descrizione = db.Column(db.String(255), nullable=False)
    data = db.Column(db.DateTime(), nullable=False)
    link_partecipazione = db.Column(db.String(255), nullable=True)
    link_registrazione = db.Column(db.String(255), nullable=True)

    corso_id = db.Column(db.Integer(), db.ForeignKey("corso.id"))

    def __init__(self, nome, descrizione, data, link_partecipazione='', link_registrazione=''):        
        self.nome = nome
        self.descrizione = descrizione
        self.data = data
        self.link_partecipazione = link_partecipazione
        self.link_registrazione = link_registrazione

    def __repr__(self):
        return "<Descrizione '{}'. Link registrazione>".format(self.descrizione, self.link_registrazione)

    @staticmethod
    def insert_test_serate():
        lista_serate = [
            ("Flask 1", "Introduzione a Flask e ai web server con Jinja Base", datetime.datetime(2020, 10, 12, hour=20), '', 'https://www.youtube.com/watch?v=FPI5-oGKiVI&t=759s'),
            ("Flask 2", "Jinja avanzato e Forms", datetime.datetime(2020, 10, 19, hour=20), '', 'https://www.youtube.com/watch?v=C-iEkd-BpE4'),
            ("Flask 3", "Flask con Database", datetime.datetime(2020, 10, 26, hour=20), '', 'https://www.youtube.com/watch?v=rCXhuSiOcZU'),
            ("Flask 4", "Review con Andrea", datetime.datetime(2020, 11, 2, hour=20), '', 'https://www.youtube.com/watch?v=izIKXOrbI5U'),
            ("Flask 5", "Review con Mario", datetime.datetime(2020, 11, 9, hour=20), '', 'https://vimeo.com/478050019'),
            ("Flask 6", "Blueprints, refactoring e tests con Mario", datetime.datetime(2020, 11, 16, hour=20), 'https://zoom.us/j/99953652561?pwd=NFpGVzBJazJXOW5MMEQvNFBrVnNLUT09', ''),
        ]
        corso_flask = Corso.query.filter_by(nome="Flask").first()
        for serata in lista_serate:
            serata_db = Serata.query.filter_by(nome=serata[0]).first()
            if serata_db is None:
                serata_db = Serata(*serata)
                serata_db.corso_id = corso_flask.id
                db.session.add(serata_db)
            db.session.commit()
Ejemplo n.º 26
0
class Devices(db.Model):
    __tablename__ = 'devices'
    device_id = db.Column(db.Integer(), primary_key=True)
    unique_id = db.Column(db.String(100), unique=True)

    def __init__(self, unique_id):
        self.unique_id = unique_id

    def __repr__(self):
        return '<Device %r>' % self.unique_id
Ejemplo n.º 27
0
class Item(db.Model):
    __tablename__ = 'items'
    id = db.Column(db.BigInteger, primary_key=True)
    title = db.Column(db.String(length=100), nullable=False)
    description = db.Column(db.Text(),nullable=False)
    price = db.Column(db.DECIMAL(precision=20, scale=4), nullable=False)
    quantity = db.Column(db.Integer(),default=0,nullable=False)
    discount = db.Column(db.Integer(),default=0,nullable=False)
    details = db.Column(db.Text())
    images = db.Column(db.Text, nullable=False)

    product_id = db.Column(db.BigInteger, db.ForeignKey('products.id'),nullable=False)
    product = db.relationship('Product')

    orders = db.relationship('Order')

    created = db.Column(db.TIMESTAMP, default=datetime.datetime.now, nullable=False)
    updated = db.Column(db.TIMESTAMP, default=datetime.datetime.now, nullable=False, onupdate=datetime.datetime.now)
    def __str__(self):
        return  " محصول :"+str(self.product.title) + " آیتم: " + self.title
Ejemplo n.º 28
0
class User(db.Model):

    __tablename__ = "users"
    __table_args__ = {'sqlite_autoincrement': True}

    id = db.Column(db.Integer, primary_key=True)
    chat_id = db.Column(db.Integer(), unique=True)
    page = db.Column(db.String(), default=pages.no_page)

    def __repr__(self):
        return f"<User {self.chat_id}>"
Ejemplo n.º 29
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer(), primary_key=True)
    email = db.Column(db.String(30), nullable=False, unique=True)
    password = db.Column(db.String(),nullable=False)

    matricola = db.Column(db.String(6), nullable=False, unique=True)
    immatriculation_year = db.Column(db.Integer(), nullable=False)
    num_of_ects = db.Column(db.Float(), nullable=False)

    weighted_mean = db.Column(db.Float(), nullable=False)

    score = db.Column(db.Float())

    has_already_done_erasmus = db.Column(db.Boolean())

    choice1 = db.Column(db.String())
    choice2 = db.Column(db.String())
    choice3 = db.Column(db.String())

    registration_date = db.Column(db.DateTime(), nullable=False, default = datetime.now)
Ejemplo n.º 30
0
class Person(db.Model):
    """Person class which initiates each row of the db with
        a unique uuid using the standard library
    """

    __tablename__ = 'people'
    id = db.Column(db.String, primary_key=True)
    survived = db.Column(db.Boolean(), default=False, nullable=False)
    passengerClass = db.Column(db.Integer(), nullable=False)
    name = db.Column(db.String(255), nullable=False)
    sex = db.Column(db.String(255), nullable=False)
    age = db.Column(db.Integer(), nullable=False)
    siblingsOrSpousesAboard = db.Column(db.Integer(), nullable=False)
    parentsOrChildrenAboard = db.Column(db.Integer(), nullable=False)
    fare = db.Column(db.Float(), nullable=False)

    def __init__(self, survived, passengerClass, name, sex, age,
                 siblingsOrSpousesAboard, parentsOrChildrenAboard, fare):

        self.id = str(uuid4())
        self.survived = survived
        self.passengerClass = passengerClass
        self.name = name
        self.sex = sex
        self.age = age
        self.siblingsOrSpousesAboard = siblingsOrSpousesAboard
        self.parentsOrChildrenAboard = parentsOrChildrenAboard
        self.fare = fare

    def to_json(self):
        return {
            'uuid': self.id,
            'survived': self.survived,
            'passengerClass': self.passengerClass,
            'name': self.name,
            'sex': self.sex,
            'age': self.age,
            'siblingsOrSpousesAboard': self.siblingsOrSpousesAboard,
            'parentsOrChildrenAboard': self.parentsOrChildrenAboard,
            'fare': self.fare
        }