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

Fix #179 : alias for upsert calls #180

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Conversation

erichare
Copy link
Collaborator

deprecate upsert(), use upsert_one() instead

@erichare erichare linked an issue Jan 31, 2024 that may be closed by this pull request
astrapy/db.py Outdated Show resolved Hide resolved
astrapy/db.py Outdated
# Deprecated: call the upsert_one method
DEPRECATION_MESSAGE = "Method 'upsert' of AstraDBCollection is deprecated. Please switch to method 'upsert_one'."

warn(DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could factorize in a deprecation_warning method ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree- maybe a method decorator is even less intrusive. For that matter we might just use this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like this idea! I'm going to push an update now which uses the deprecation module. it looks very dev friendly, and seems to work with our tests. We can easily update the messages etc and now they're just decorators on the function itself. See the update and let me know if you guys have any further feedback @cbornet @hemidactylus . Thanks :)

@erichare erichare self-assigned this Jan 31, 2024
@erichare erichare merged commit bb33ec3 into master Jan 31, 2024
2 checks passed
@erichare erichare deleted the bugfix/#179-upsert-rename branch January 31, 2024 21:14
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.

alias upsert => upsert_one (with deprecation)
3 participants