def METHOD_NAME(self, query: AnyStr, *args: Any, **kwargs: Any) -> Iterator[DBApiCursor]:
    curr: DBApiCursor = None
    db_args = args if args else kwargs if kwargs else None
    with self._conn.cursor() as curr:  # type: ignore[assignment]
        try:
            curr.execute(query, db_args, num_statements=0)
            yield SnowflakeCursorImpl(curr)  # type: ignore[abstract]
        except snowflake_lib.Error as outer:
            try:
                self._reset_connection()
            except snowflake_lib.Error:
                self.close_connection()
                self.open_connection()
            raise outer