Record page title and endpoint with query
This commit is contained in:
parent
ff11922c35
commit
b894188f1a
4 changed files with 19 additions and 12 deletions
|
|
@ -111,6 +111,8 @@ class WikidataQuery(Base):
|
|||
error_text = Column(String)
|
||||
query_template = Column(String)
|
||||
row_count = Column(Integer)
|
||||
page_title = Column(String)
|
||||
endpoint = Column(String)
|
||||
|
||||
@property
|
||||
def duration(self):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import urllib.parse
|
|||
import os
|
||||
import dateutil.parser
|
||||
import hashlib
|
||||
from flask import request, render_template
|
||||
from flask import request, render_template, g
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from .model import WikidataQuery
|
||||
|
|
@ -47,7 +47,9 @@ def record_query(query, query_template=None):
|
|||
start_time=start,
|
||||
sparql_query=query,
|
||||
path=request.full_path.rstrip('?'),
|
||||
query_template=query_template)
|
||||
query_template=query_template,
|
||||
page_title=getattr(g, 'title', None),
|
||||
endpoint=request.endpoint)
|
||||
database.session.add(db_query)
|
||||
database.session.commit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue