weather_api/models.py
Argiris Deligiannidis 46a5b5c039 Update code base
2024-04-07 13:01:31 +03:00

18 lines
755 B
Python

from sqlalchemy.sql.expression import null
from db_connector import database
from sqlalchemy import Integer, Column, Float, VARCHAR
class Location(database):
#NOTE: Taumata longest place name on earth, 85 characters,
# also accounting for the extended ASCII characters,
# varchar of 200 Bytes should be enough for every use
# case even with multiword names such as "The Big Apple"
__tablename__='locations'
id=Column(Integer,primary_key=True,autoincrement=True)
name=Column(VARCHAR(200),nullable=False)
latitude=Column(Float,nullable=False)
longitude=Column(Float,nullable=False)
def __repr__(self):
return "id={} name={} longitude={} latitude={}".format(self.id,self.name,self.longitude,self.latitude)