def ask()

in databao/core/thread.py [0:0]


    def ask(self, query: str, *, rows_limit: int | None = None, stream: bool | None = None) -> Self:
        """Append a new user query to this thread.

        Returns self to allow chaining (e.g., thread.ask("...")).

        Setting rows_limit has no effect in lazy mode.
        """
        # NB. A new Opa is created even if it's identical to the previous one.
        if self._opas_processed_count < len(self._opas):
            assert self._lazy_mode
            self._opas[-1].append(Opa(query=query))
        else:
            # Add new Opa group
            self._opas.append([Opa(query=query)])

        # Invalidate old results so they are not used by repr methods
        self._data_result = None
        self._visualization_result = None

        # If multiple .asks are chained, the last setting takes precedence.
        # Tracking the stream setting for each ask in a chain would not work with "opa-collocation".
        self._stream_ask = stream

        if not self._lazy_mode:
            self._materialize(rows_limit)

        return self