class_docstr: A Database connection.
class_docstr_tok: ["A","Database","connection","."]
docstr: Executes the given SQL query against the connected Database.
  Parameters can, optionally, be provided. Returns a RecordCollection,
  which can be iterated over to get result rows as dictionaries.
docstr_tok: ["Executes","the","given","SQL","query","against","the","connected","Database",".","Parameters","can",",","optionally",",","be","provided",".","Returns","a","RecordCollection",",","which","can","be","iterated","over","to","get","result","rows","as","dictionaries","."]
code: def query(self, query, fetchall=False, **params):
      """Executes the given SQL query against the connected Database.
      Parameters can, optionally, be provided. Returns a RecordCollection,
      which can be iterated over to get result rows as dictionaries.
      """
  
      # Execute the given query.
      cursor = self._conn.execute(
          text(query), **params
      )  # TODO: PARAMS GO HERE
  
      # Row-by-row Record generator.
      row_gen = (Record(cursor.keys(), row) for row in cursor)
  
      # Convert psycopg2 results to RecordCollection.
      results = RecordCollection(row_gen)
  
      # Fetch all results if desired.
      if fetchall:
          results.all()
  
      return results
  
imports: import os
  from sys import stdout
  from collections import OrderedDict
  from contextlib import contextmanager
  from inspect import isclass
  import tablib
  from docopt import docopt
  from sqlalchemy import create_engine, exc, inspect, text
label_desc: Use image node_id 6 for calling the Connection obj's underlying member method code with example usage: obj.query(query, fetchall) and returns: results