You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The current impementation of the @firestore.transactional decorator forces the transaction to be the first argument. This makes the wrapper unusable on methods which by design have self as their first argument.
Describe the solution you'd like
Ideally, the transaction object can be passed through keywords arguments. It should be possible to inspect the to_wrap function provided to check if a parameter named transaction exists. If not, fall back to the current implementation.
Describe alternatives you've considered
This can be worked around by using static methods, but makes for ugly code:
client=firestore.Client()
classMyClass:
def__init__(self, a):
self.a=a@staticmethod@firestore.transactionaldef_save_transactional(transaction, self):
# Note: Not an actual "self" as normally understood in python codeclient.document("data/test").set({"a": self.a})
defsave(self):
transaction=client.transaction()
self._save_transactional(transaction, self)
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The current impementation of the
@firestore.transactional
decorator forces thetransaction
to be the first argument. This makes the wrapper unusable on methods which by design haveself
as their first argument.Describe the solution you'd like
Ideally, the transaction object can be passed through keywords arguments. It should be possible to inspect the
to_wrap
function provided to check if a parameter namedtransaction
exists. If not, fall back to the current implementation.Describe alternatives you've considered
This can be worked around by using static methods, but makes for ugly code:
Additional context
N/A
The text was updated successfully, but these errors were encountered: