Skip to content

Commit

Permalink
fix: docstring update to fix outdated upsert_many info (#139)
Browse files Browse the repository at this point in the history
Co-authored-by: Cody Fincher <cody.fincher@gmail.com>
  • Loading branch information
darinkishore and cofin committed Mar 14, 2024
1 parent 44fa4e9 commit 5aa8e43
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: "3.12"
python: python3
default_install_hook_types: [commit-msg, pre-commit]
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
Expand Down
5 changes: 4 additions & 1 deletion advanced_alchemy/repository/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,9 @@ async def upsert_many(
Update instances with the attribute values present on `data`, or create a new instance if
one doesn't exist.
!!! tip
In most cases, you will want to set `match_fields` to the combination of attributes, excluded the primary key, that define uniqueness for a row.
Args:
data: Instance to update existing, or be created. Identifier used to determine if an
existing instance exists is the value of an attribute on ``data`` named as value of
Expand All @@ -1017,7 +1020,7 @@ async def upsert_many(
no_merge: Skip the usage of optimized Merge statements
:class:`SQLAlchemyAsyncRepository.auto_commit <SQLAlchemyAsyncRepository>`
match_fields: a list of keys to use to match the existing model. When
empty, all fields are matched.
empty, automatically uses ``self.id_attribute`` (`id` by default) to match .
Returns:
The updated or created instance.
Expand Down
5 changes: 4 additions & 1 deletion advanced_alchemy/repository/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@ def upsert_many(
Update instances with the attribute values present on `data`, or create a new instance if
one doesn't exist.
!!! tip
In most cases, you will want to set `match_fields` to the combination of attributes, excluded the primary key, that define uniqueness for a row.
Args:
data: Instance to update existing, or be created. Identifier used to determine if an
existing instance exists is the value of an attribute on ``data`` named as value of
Expand All @@ -1018,7 +1021,7 @@ def upsert_many(
no_merge: Skip the usage of optimized Merge statements
:class:`SQLAlchemyAsyncRepository.auto_commit <SQLAlchemyAsyncRepository>`
match_fields: a list of keys to use to match the existing model. When
empty, all fields are matched.
empty, automatically uses ``self.id_attribute`` (`id` by default) to match .
Returns:
The updated or created instance.
Expand Down
8 changes: 4 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5aa8e43

Please sign in to comment.