-
Notifications
You must be signed in to change notification settings - Fork 2
/
openalex_date_last_doi.py
60 lines (49 loc) · 1.55 KB
/
openalex_date_last_doi.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from app import db
from datetime import datetime
class OpenalexDateLastDOI(db.Model):
__tablename__ = "openalex_date_last_doi"
updated = db.Column(db.DateTime)
issn_l = db.Column(db.Text, primary_key=True)
date_last_doi = db.Column(db.Text)
def __init__(self, journal):
self.updated = datetime.utcnow().isoformat()
for attr in ("issn_l", "date_last_doi"):
setattr(self, attr, getattr(journal, attr))
super(OpenalexDateLastDOI, self).__init__()
def get_values(self):
return (
self.updated,
self.issn_l,
self.date_last_doi,)
@classmethod
def get_insert_column_names(cls):
return ["updated",
"issn_l",
"date_last_doi",]
def __repr__(self):
return "<{} ({}) '{}'>".format(self.__class__.__name__, self.issn_l, self.date_last_doi)
class OpenalexDateLastDOIFromOA(db.Model):
__tablename__ = "openalex_date_last_doi_from_oa"
updated = db.Column(db.DateTime)
issn_l = db.Column(db.Text, primary_key=True)
openalex_id = db.Column(db.Text)
date_last_doi = db.Column(db.Text)
def __init__(self, journal):
self.updated = datetime.utcnow().isoformat()
for attr in ("issn_l", "date_last_doi"):
setattr(self, attr, getattr(journal, attr))
super(OpenalexDateLastDOIFromOA, self).__init__()
def get_values(self):
return (
self.updated,
self.issn_l,
self.openalex_id,
self.date_last_doi,)
@classmethod
def get_insert_column_names(cls):
return ["updated",
"issn_l",
"openalex_id",
"date_last_doi",]
def __repr__(self):
return "<{} ({}) '{}'>".format(self.__class__.__name__, self.issn_l, self.date_last_doi)