Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SQLAlchemy Repository for Multiple Tables #118

Closed
migduroli opened this issue Oct 5, 2023 · 0 comments · Fixed by #117
Closed

Refactor SQLAlchemy Repository for Multiple Tables #118

migduroli opened this issue Oct 5, 2023 · 0 comments · Fixed by #117
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@migduroli
Copy link
Collaborator

Summary

Our current SQLAlchemy repository module, represented by the SQLAlchemyRepository class, is designed to handle operations on a single table and includes standard CRUDLDel methods. However, as our application grows, we find the need to work with multiple tables in a more organized and modular way.

Motivation

  1. Modularity: The current design limits our ability to manage multiple tables efficiently. We want to refactor our repository structure to promote better code modularity and separation of concerns.

  2. Code Reusability: To enhance code reusability, we propose creating a new class called SQLAlchemyTableManager, responsible for encapsulating the CRUDLD (Create, Retrieve, Update, Delete, List, Drop) methods for a specific table.

  3. Improved Testing: By refactoring our repository structure, we can make our tests more granular and specific, which can help in maintaining and expanding our codebase.

Proposed Changes

  1. Introduce a new class, SQLAlchemyTableManager, which encapsulates CRUDLDel methods for a specific table.

  2. Create a new class, SQLAlchemyTableRepository, that inherits from SQLAlchemyRepository and uses SQLAlchemyTableManager to handle operations on a specific table.

  3. Update import statements in the codebase to reflect the use of SQLAlchemyTableRepository where necessary.

  4. Modify tests to work seamlessly with the new repository structure.

Impact

  • Improved code organization and separation of concerns.
  • Enhanced modularity for working with multiple tables.
  • Updated import statements in the codebase.
  • Modifications to tests to accommodate the new repository structure.
@migduroli migduroli added the enhancement New feature or request label Oct 5, 2023
@migduroli migduroli linked a pull request Oct 5, 2023 that will close this issue
5 tasks
@migduroli migduroli added this to the 1.7.0 milestone Oct 5, 2023
@migduroli migduroli mentioned this issue Oct 5, 2023
github-actions bot pushed a commit that referenced this issue Sep 3, 2024
# [v1.7.0](v1.6.0...v1.7.0) (2024-09-03)

## ✨ New Features
- [`96229a1`](96229a1)  Decouple table manager logic from repositories (#118) (Issues: [`#118`](https://github.com/vortico/flama/issues/))
- [`d944180`](d944180)  Enhanced OpenAPI docstrings (#121) (Issues: [`#121`](https://github.com/vortico/flama/issues/))
- [`a66d5ee`](a66d5ee)  Enhanced actions for DDD repositories (#124) (Issues: [`#124`](https://github.com/vortico/flama/issues/))
- [`0695c77`](0695c77)  ASGI Cookies component
- [`cd06bdb`](cd06bdb)  Python 3.12 compatibility (#119) (Issues: [`#119`](https://github.com/vortico/flama/issues/))
- [`a2ef280`](a2ef280)  Single type injection (#126) (Issues: [`#126`](https://github.com/vortico/flama/issues/))
- [`869711d`](869711d)  Connections manager for SQLAlchemy module (#135) (Issues: [`#135`](https://github.com/vortico/flama/issues/))
- [`4899473`](4899473)  Authentication mechanism (#137) (Issues: [`#137`](https://github.com/vortico/flama/issues/))
- [`03634c2`](03634c2)  Ordering for repositories list (#139) (Issues: [`#139`](https://github.com/vortico/flama/issues/))
- [`070fb4f`](070fb4f)  Enhanced operations for CRUD (#141) (Issues: [`#141`](https://github.com/vortico/flama/issues/))
- [`bd4f6c1`](bd4f6c1)  Non-blocking errors on schema generation
- [`4e5ba47`](4e5ba47)  Implement DDD for HTTP resources
- [`c177eef`](c177eef)  Use PartialSchema for all-optional schema version
- [`336914e`](336914e)  HTTPWorker accepts client kwargs

## 🐛 Bug Fixes
- [`518a4eb`](518a4eb)  Fix resolution for routes within nested resources
- [`3e1c0a8`](3e1c0a8)  Include nested applications in Lifespan (#130) (Issues: [`#130`](https://github.com/vortico/flama/issues/))
- [`036264e`](036264e)  Resolve url match multiple path params
- [`2664aba`](2664aba)  Remove unintended sqlalchemy import (#143) (Issues: [`#143`](https://github.com/vortico/flama/issues/))
- [`cde8071`](cde8071)  Serve flama logo from its repository (#144) (Issues: [`#144`](https://github.com/vortico/flama/issues/))
- [`9bcd6d7`](9bcd6d7)  Accept empty body as a valid input for schema validation
- [`c4d0915`](c4d0915)  Fix middleware types
- [`5716a6f`](5716a6f)  Allow nullable nested schemas for Pydantic
- [`8836aa7`](8836aa7)  Atomic operations on SQLAlchemy connections management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants