async def _extract_database_content(
        self, client: httpx.AsyncClient, database_schemas: Dict[str, dict]
    ) -> AsyncGenerator[ChunkEntity, None]:
        """Extract all content from databases with full page content aggregation."""
        logger.info("Phase 3: Extracting database content with aggregation")

        for database_id, schema in database_schemas.items():
            database_title = self._extract_rich_text_plain(schema.get("title", []))
            logger.info(f"Processing database: {database_title}")

            # Yield database entity
            database_entity = self._create_database_entity(schema)
            yield database_entity

            # Query all pages in the database
            async for page in self._query_database_pages(client, database_id):
                page_id = page["id"]
                if page_id in self._processed_pages:
                    continue

                try:
                    # Create breadcrumbs for database pages
                    breadcrumbs = [
                        Breadcrumb(
                            entity_id=database_id, name=database_entity.title, type="database"
                        )
                    ]

                    # Always use lazy loading for better performance
                    page_entity = await self._create_lazy_page_entity(
                        page, breadcrumbs, database_id, schema
                    )
                    yield page_entity

                    # Don't yield files separately - they'll be handled during materialization
                    self._processed_pages.add(page_id)

                except Exception as e:
                    logger.error(f"Error processing database page {page_id}: {str(e)}")
                    continue
Extract all content from databases with full page content aggregation.
backend/airweave/platform/sources/notion.py