import peewee db = peewee.SqliteDatabase('leo_sats.sqlite') class BaseModel(peewee.Model): class Meta: database = db class Satellite(BaseModel): object_id = peewee.CharField(unique=True) object_name = peewee.CharField(index=True) launch = peewee.DateField(index=True) last_downloaded_orbits = peewee.DateField(null=True) class Orbit(BaseModel): satellite = peewee.ForeignKeyField(Satellite, backref='orbits') training_data = peewee.BooleanField(default=False, index=True) testing_data = peewee.BooleanField(default=False, index=True) debuging_data = peewee.BooleanField(default=False, index=True) epoch = peewee.DateTimeField(index=True) apoapsis = peewee.DoubleField() arg_of_pericenter = peewee.DoubleField() bstar = peewee.DoubleField() eccentricity = peewee.DoubleField() inclination = peewee.DoubleField() mean_anomaly = peewee.DoubleField() mean_motion = peewee.DoubleField() mean_motion_ddot = peewee.DoubleField() mean_motion_dot = peewee.DoubleField() periapsis = peewee.DoubleField() ra_of_asc_node = peewee.DoubleField() rev_at_epoch = peewee.IntegerField() semimajor_axis = peewee.DoubleField() if __name__ == '__main__': db.connect() db.create_tables([Satellite, Orbit])