-
Notifications
You must be signed in to change notification settings - Fork 10
/
models.py
25 lines (23 loc) · 1.11 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import func
import datetime
# create an object of sqlalchemy, it should be initialized when flask application is created
# and this object should be passed as db variable in app.py
db = SQLAlchemy()
class LanguageStats(db.Model):
__tablename__ = 'language_stats'
language_code = db.Column(db.String(10), primary_key=True, index=True) # language_code is primary key
main_aps = db.Column(db.Integer)
main_pages = db.Column(db.Integer)
main_with_out_scan = db.Column(db.Integer)
main_with_scan = db.Column(db.Integer)
not_proofread = db.Column(db.Integer)
num_of_pages = db.Column(db.Integer)
page_aps = db.Column(db.Integer)
problematic = db.Column(db.Integer)
proofread = db.Column(db.Integer)
validated = db.Column(db.Integer)
without_text = db.Column(db.Integer)
timestamp = db.Column(db.String(100)) # Store timestamp as string
created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
updated_at = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())