Returns the count of records in a table.

    If the default cursor is a tuple or named tuple, this method will work without specifying an
    extract parameter. If it is a dict cursor, it is necessary to specify any value other than
    'index' for extract. This method will not work with cursors that aren't like tuple, namedtuple
    or dict cursors.

    :param table_name: the name of the table to count records on
    :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints.
    :param extract: the property to pull the count value from the cursor
    :return: the nuber of records matching the constraints

def count(self, table_name, constraints=None, *, extract="index"):
    """Returns the count of records in a table.

    If the default cursor is a tuple or named tuple, this method will work without specifying an
    extract parameter. If it is a dict cursor, it is necessary to specify any value other than
    'index' for extract. This method will not work with cursors that aren't like tuple, namedtuple
    or dict cursors.

    :param table_name: the name of the table to count records on
    :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints.
    :param extract: the property to pull the count value from the cursor
    :return: the nuber of records matching the constraints
    """
    where, params = self.sql_writer.parse_constraints(constraints)
    sql = "select count(*) as count from {0} where {1};".format(table_name, where or "1 = 1")
    # NOTE: Won't work right with dict cursor
    return self.get_scalar(self.execute(sql, params), 0 if extract == "index" else "count")