Skip to content

Conversation

@tao12345666333
Copy link
Contributor

close #170

  • Implement SQLite integration with SQLAlchemy/SQLModel
  • Add support for JSON-serialized embeddings (no native vector type)
  • Implement brute-force in-memory vector search for SQLite
  • Add SQLite repositories for Resources, Items, Categories, and Relations
  • Add documentation and integration tests

- Implement SQLite integration with SQLAlchemy/SQLModel
- Add support for JSON-serialized embeddings (no native vector type)
- Implement brute-force in-memory vector search for SQLite
- Add SQLite repositories for Resources, Items, Categories, and Relations
- Add documentation and integration tests

Signed-off-by: Jintao Zhang <[email protected]>
Copilot AI review requested due to automatic review settings January 9, 2026 12:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds SQLite as a lightweight, file-based storage backend for MemU, providing an alternative to the existing in-memory and PostgreSQL backends. The implementation follows the existing repository pattern and includes comprehensive documentation.

Key Changes

  • SQLite storage backend with SQLAlchemy/SQLModel integration using JSON-serialized embeddings
  • Brute-force in-memory vector search implementation for SQLite (no native vector support)
  • Complete repository implementations for Resources, Items, Categories, and Relations
  • Integration tests and comprehensive documentation

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_sqlite.py Integration test demonstrating SQLite backend with memorize/retrieve operations
src/memu/database/sqlite/sqlite.py Core SQLiteStore implementation managing repositories and database lifecycle
src/memu/database/sqlite/session.py Session manager handling SQLite engine and connection lifecycle
src/memu/database/sqlite/schema.py Schema builder with model caching and dynamic scope field support
src/memu/database/sqlite/repositories/base.py Base repository class with shared filtering, embedding serialization utilities
src/memu/database/sqlite/repositories/resource_repo.py Resource repository with CRUD operations and caching
src/memu/database/sqlite/repositories/memory_item_repo.py Memory item repository with vector search and update operations
src/memu/database/sqlite/repositories/memory_category_repo.py Category repository with get-or-create pattern
src/memu/database/sqlite/repositories/category_item_repo.py Relation repository managing item-category links
src/memu/database/sqlite/repositories/init.py Repository package exports
src/memu/database/sqlite/models.py SQLModel definitions with JSON embedding properties and table configurations
src/memu/database/sqlite/init.py Package entry point with database builder function
src/memu/database/factory.py Updated factory to support SQLite provider selection
src/memu/database/init.py Added sqlite to package exports
src/memu/app/settings.py Extended configuration to support sqlite provider and updated DSN description
docs/sqlite.md Comprehensive documentation covering setup, configuration, migration, and troubleshooting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Cast json.loads result to list explicitly to satisfy mypy
- Ensure strict type checking passes for new sqlite module
- Rename cat_id to category_id for consistency
- Use slice assignment for in-place cache update in unlink_item_category
- Add logging for embedding JSON parse failures
- Use specific exception types instead of bare Exception
- Remove incorrect Raises section from docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2026NewYearChallenge] Database Integration——SQLite

1 participant