class_docstr: SQLite3 TaskRecord backend.
docstr: Turn a mongodb-style search dict into an SQL query.
docstr_tok: ["Turn","a","mongodb-style","search","dict","into","an","SQL","query","."]
code: def _render_expression(self, check):
      """Turn a mongodb-style search dict into an SQL query."""
      expressions = []
      args = []
  
      skeys = set(check.keys())
      skeys.difference_update(set(self._keys))
      skeys.difference_update({"buffers", "result_buffers"})
      if skeys:
          raise KeyError("Illegal testing key(s): %s" % skeys)
  
      for name, sub_check in check.items():
          if isinstance(sub_check, dict):
              for test, value in sub_check.items():
                  try:
                      op = operators[test]
                  except KeyError:
                      raise KeyError("Unsupported operator: %r" % test)
                  if isinstance(op, tuple):
                      op, join = op
  
                  if value is None and op in null_operators:
                      expr = f"{name} {null_operators[op]}"
                  else:
                      expr = f"{name} {op} ?"
                      if isinstance(value, (tuple, list)):
                          if op in null_operators and any(
                              [v is None for v in value]
                          ):
                              # equality tests don't work with NULL
                              raise ValueError(
                                  "Cannot use %r test with NULL values on SQLite backend"
                                  % test
                              )
                          expr = "( %s )" % (
                              join.join([expr] * len(value))
                          )
                          args.extend(value)
                      else:
                          args.append(value)
                  expressions.append(expr)
          else:
              # it's an equality check
              if sub_check is None:
                  expressions.append("%s IS NULL" % name)
              else:
                  expressions.append("%s = ?" % name)
                  args.append(sub_check)
  
      expr = " AND ".join(expressions)
      return expr, args
  
imports: import json
  import os
  from datetime import datetime
  from dateutil.parser import parse
  from tornado import ioloop
  from traitlets import Dict, Instance, List, Unicode
  from ..util import ensure_timezone, extract_dates
  from .dictdb import BaseDB
label_desc: Use image node_id 8 for calling the SQLiteDB obj's underlying member method code with example usage: obj._render_expression(check) and returns: expr,  args