[server.rqlannotation] rename SQLGenAnnotator to RQLAnnotator
This class is in charge of annotating the RQL syntax tree with
various bits of information, like (in)variance, use of
full-text-index, etc. It is a needed step before the generation
of SQL, but does not touch SQL directly. Hence RQLAnnotator
seems a better name.
--- a/cubicweb/server/querier.py Fri Mar 15 21:35:59 2019 +0100
+++ b/cubicweb/server/querier.py Wed Mar 13 10:26:15 2019 +0100
@@ -36,7 +36,7 @@
from cubicweb.utils import QueryCache, RepeatList
from cubicweb.misc.source_highlight import highlight_terminal
-from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata
+from cubicweb.server.rqlannotation import RQLAnnotator, set_qdata
from cubicweb.server.ssplanner import (READ_ONLY_RTYPES, add_types_restriction,
SSPlanner)
from cubicweb.server.edition import EditedEntity
@@ -216,7 +216,7 @@
noinvariant = ()
if cached is None:
self.rqlhelper.simplify(union)
- self.querier.sqlgen_annotate(union)
+ self.querier.rqlannotator.annotate(union)
set_qdata(self.schema.rschema, union, noinvariant)
if union.has_text_query:
self.cache_key = None
@@ -481,7 +481,7 @@
# rql planner
self._planner = SSPlanner(schema, self._repo.vreg.rqlhelper)
# sql generation annotator
- self.sqlgen_annotate = SQLGenAnnotator(schema).annotate
+ self.rqlannotator = RQLAnnotator(schema)
def clear_caches(self, eids=None, etypes=None):
if eids is None:
--- a/cubicweb/server/rqlannotation.py Fri Mar 15 21:35:59 2019 +0100
+++ b/cubicweb/server/rqlannotation.py Wed Mar 13 10:26:15 2019 +0100
@@ -117,7 +117,8 @@
var._q_invariant = False
-class SQLGenAnnotator(object):
+class RQLAnnotator(object):
+ """Annotate the RQL abstract syntax tree to inform the SQL generation"""
def __init__(self, schema):
self.schema = schema
--- a/cubicweb/server/sources/native.py Fri Mar 15 21:35:59 2019 +0100
+++ b/cubicweb/server/sources/native.py Wed Mar 13 10:26:15 2019 +0100
@@ -472,7 +472,7 @@
rqlst = self.repo.vreg.rqlhelper.parse(rql)
rqlst.restricted_vars = ()
rqlst.children[0].solutions = sols
- self.repo.querier.sqlgen_annotate(rqlst)
+ self.repo.querier.rqlannotator.annotate(rqlst)
set_qdata(self.schema.rschema, rqlst, ())
return rqlst
--- a/cubicweb/server/test/unittest_rqlannotation.py Fri Mar 15 21:35:59 2019 +0100
+++ b/cubicweb/server/test/unittest_rqlannotation.py Wed Mar 13 10:26:15 2019 +0100
@@ -22,14 +22,14 @@
from cubicweb.devtools.repotest import BaseQuerierTC
-class SQLGenAnnotatorTC(BaseQuerierTC):
+class RQLAnnotatorTC(BaseQuerierTC):
def setUp(self):
handler = devtools.get_test_db_handler(devtools.TestServerConfiguration('data', __file__))
handler.build_db_cache()
repo, _cnx = handler.get_repo_and_cnx()
self.__class__.repo = repo
- super(SQLGenAnnotatorTC, self).setUp()
+ super(RQLAnnotatorTC, self).setUp()
def test_0_1(self):
with self.admin_access.cnx() as cnx: