def derived(self, statement, params=(), replace=False):
        """
        Returns a new query object set up correctly with
        the *statement* and *params* appended to the end
        of the new instance's internal query and params,
        along with the current instance's connection.

        :param statement: The SQL query string to append.
        :param params: The parameters to append.
        :param replace: Whether to replace the entire
            SQL query.
        """
        return Query(
            db=self.db,
            sql=(statement,) if replace else self.sql + (statement,),
            params=self.params + params,
        )