File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,8 @@ def operation_type(self) -> TransactionOperationType:
331331 @property
332332 def metadata (self ) -> Dict [str , str ]:
333333 """Gets metadata."""
334- return self ._metadata
334+ return {} if self ._metadata is None else self ._metadata
335+
335336
336337class EncryptRequestIterator (DaprRequest ):
337338 """An iterator for cryptography encrypt API requests.
Original file line number Diff line number Diff line change @@ -939,7 +939,7 @@ def execute_state_transaction(
939939 key = o .key ,
940940 value = to_bytes (o .data ) if o .data is not None else to_bytes ('' ),
941941 etag = common_v1 .Etag (value = o .etag ) if o .etag is not None else None ,
942- metadata = o .metadata if o . metadata is not None else dict () ,
942+ metadata = o .metadata ,
943943 ),
944944 )
945945 for o in operations
Original file line number Diff line number Diff line change 9090
9191 # Outbox pattern
9292 # pass in the ("outbox.projection", "true") metadata to the transaction to enable the outbox pattern.
93- d .execute_state_transaction (store_name = storeName , operations = [
94- TransactionalStateOperation (key = "key1" , data = "val1" ,
95- metadata = {"outbox.projection" : "false" }),
96- TransactionalStateOperation (key = "key1" , data = "val2" ,
97- metadata = {"outbox.projection" : "true" }), ], )
98- print ("Transaction with outbox pattern executed successfully!" )
99-
100- val = d .get_state (store_name = storeName , key = "key1" ).data
93+ d .execute_state_transaction (
94+ store_name = storeName ,
95+ operations = [
96+ TransactionalStateOperation (
97+ key = 'key1' , data = 'val1' , metadata = {'outbox.projection' : 'false' }
98+ ),
99+ TransactionalStateOperation (
100+ key = 'key1' , data = 'val2' , metadata = {'outbox.projection' : 'true' }
101+ ),
102+ ],
103+ )
104+ print ('Transaction with outbox pattern executed successfully!' )
105+
106+ val = d .get_state (store_name = storeName , key = 'key1' ).data
101107 print (f'Got value after outbox pattern: { val } ' )
102108
103109 # Transaction delete
You can’t perform that action at this time.
0 commit comments