From c4e5b5177a129850ef1846fa23d7cdece609c17c Mon Sep 17 00:00:00 2001 From: Ali Tavallaie Date: Sat, 28 Sep 2024 18:56:10 +0330 Subject: [PATCH] chore: fixing some python code intention within README --- tembo-pgmq-python/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tembo-pgmq-python/README.md b/tembo-pgmq-python/README.md index d627984..74ffd90 100644 --- a/tembo-pgmq-python/README.md +++ b/tembo-pgmq-python/README.md @@ -274,17 +274,17 @@ from tembo_pgmq_python.decorators import transaction ```python @transaction def transactional_operation(queue: PGMQueue, conn=None): -# Perform multiple queue operations within a transaction -queue.create_queue("transactional_queue", conn=conn) -queue.send("transactional_queue", {"message": "Hello, World!"}, conn=conn) + # Perform multiple queue operations within a transaction + queue.create_queue("transactional_queue", conn=conn) + queue.send("transactional_queue", {"message": "Hello, World!"}, conn=conn) ``` To execute the transaction: ```python try: -transactional_operation(queue) + transactional_operation(queue) except Exception as e: -print(f"Transaction failed: {e}") + print(f"Transaction failed: {e}") ``` In this example, the transactional_operation function is decorated with `@transaction`, ensuring all operations inside it are part of a single transaction. If an error occurs, the entire transaction is rolled back automatically. \ No newline at end of file