add TableProvider to enable future row-by-row streaming #2189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements Phase 1 of the storage migration plan to support streaming row-by-row operations for larger datasets with reduced memory pressure. It introduces the
TableProviderabstraction layer that sits between GraphRAG workflows and the underlying storage mechanism, enabling future database backends and streaming operations.All indexing workflows have been migrated from direct
Storagecalls to useTableProvider.read_dataframe()andwrite_dataframe()methods, while maintaining backward compatibility through wrapper functions.Proposed Changes
Core Infrastructure
New:
TableProviderabstract base class ingraphrag-storage/tables/read_dataframe(table_name)- read entire table as DataFramewrite_dataframe(table_name, df)- write entire table as DataFramehas_dataframe(table_name)- check if table existsfind_tables()- list all available tablesNew:
ParquetTableProviderimplementationStorageinstance (file/blob/cosmos)Context Changes
Updated
PipelineRunContextto include:input_table_provider: ParquetTableProvideroutput_table_provider: ParquetTableProviderprevious_table_provider: ParquetTableProvider | None(for update mode)Renamed
previous_storage→previous_table_providerfor consistencyNote:
output_storageremains in context for JSON files (stats.json,context.json) and GraphML snapshotsPattern change: