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

feat: multi-database configurations #151

Merged
merged 50 commits into from
Jul 1, 2024
Merged

feat: multi-database configurations #151

merged 50 commits into from
Jul 1, 2024

Conversation

cofin
Copy link
Member

@cofin cofin commented Mar 29, 2024

Allows the Litestar plugin to be configured with multiple databases

Copy link

sonarcloud bot commented Apr 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link

github-actions bot commented Apr 7, 2024

Documentation preview will be available shortly at https://jolt-org.github.io/advanced-alchemy-docs-preview/151

cofin and others added 21 commits May 2, 2024 19:12
* feat: services accept BaseModels and Structs

* fix: adds tests for converting struct and basemodel classes

* fix: correct configuration

* feat: tweak to_dict
* feat: services accept BaseModels and Structs

* fix: adds tests for converting struct and basemodel classes

* fix: correct configuration

* feat: tweak to_dict

* feat: add a `to_schema` parameter to services

* chore: linting

* fix: type checking

* feat: assert model

---------

Signed-off-by: Cody Fincher <[email protected]>
* feat: improved typing

* chore: bump version

* feat: i think this is better for linters

* chore: revert changes

* feat: use type guard

* feat: type ignore

* feat: precommit hook

* fix: updated dict type signature

* chore: linting fixes

* chore: limit concurrency per branch

* feat: lint fix

* fix: add missing returns

* fix: don't assign an extra variable

* feat: allow filters in single row queries (#222)

* wip

* feat: allow single row operations to filter

* fix: remove deprecation test
- Reverts the previous `to_schema` implementation in the service layer.  This will need to be rethought as it requires too many overloads to any customized service function.  
- Ensures that the filter values for `upsert_many` is a unique list.  This is useful when you are merging a large amount of objects on a foreign key.  The lookup will only contain a single unique entry for each key instead of one for each row.
- Adds a `schema_to_dict` method to convert incoming Pydantic or Msgspec models to dictionaries
- Adds additional type guard helpers to check for a field in a dictionary, Struct, or BaseModel
* feat: additional tests and helper methods

* feat: re-use functions

* feat: simplify logic further
@cofin cofin marked this pull request as ready for review June 30, 2024 14:20
@cofin cofin requested review from a team as code owners June 30, 2024 14:20
Copy link
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

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

Looks good!

One idea though: Since the session scope key is only used internally, how about, instead requiring the user to define one for multiple configs, we simply keep track of all the ones we have created (e.g. via a class var on the base config) and then ensure they are unique? That would make it a bit more "it just works"

Alc-Alc and others added 14 commits June 30, 2024 17:36
* feat(cli): Adds drop-all option to the litestar cli

* fix(mypy): CI failure

* tests(cli): Add tests for drop-all

* chore: remove unnecessary import

* feat: updated tests

* fix: 3.8 and 3.9 support

* chore: revert later

* revert: "chore: revert later"

This reverts commit 4091abd.

* chore: 3.8/3.9 support

* chore: add eval type check

* chore: fix lint

* feat: updated linting

---------

Co-authored-by: Alc-Alc <alc@localhost>
Co-authored-by: Cody Fincher <[email protected]>
Copy link

sonarcloud bot commented Jul 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
54.8% Coverage on New Code (required ≥ 80%)
6.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link

github-actions bot commented Jul 1, 2024

Documentation preview will be available shortly at https://litestar-org.github.io/advanced-alchemy-docs-preview/151

@cofin cofin merged commit 00803d0 into main Jul 1, 2024
12 of 13 checks passed
@cofin cofin deleted the multi-config branch July 1, 2024 17:36
cofin added a commit that referenced this pull request Jul 1, 2024
* feat: multi-database configurations
 
---------

Signed-off-by: Cody Fincher <[email protected]>
Co-authored-by: Alc-Alc <[email protected]>
Co-authored-by: Alc-Alc <alc@localhost>
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.

None yet

3 participants