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

pgmq-python: adding support for Transaction #268

Merged
merged 25 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c72c0e
feat: adding transaction as decorator
tavallaie Jun 15, 2024
39c4ac6
feat: test for transactions
tavallaie Jun 15, 2024
2e7ba20
add logger
tavallaie Jun 15, 2024
18ccefc
chore: linting
tavallaie Jun 15, 2024
405dd12
feat: successfull transaction operation
tavallaie Jun 16, 2024
b535b07
Merge branch 'main' into transaction
tavallaie Jun 16, 2024
fd15e60
chore: linting and formatting
tavallaie Jun 16, 2024
3682523
Merge branch 'transaction' of github.com:tavallaie/pgmq into transaction
tavallaie Jun 16, 2024
bae10b4
feat: adding better logger and optional for verbose
tavallaie Jun 16, 2024
2557382
feat: update readme for transaction
tavallaie Jun 16, 2024
5955c01
resolve conflict
tavallaie Sep 15, 2024
9d37d69
feat: support for transaction:
tavallaie Sep 15, 2024
ce339b3
Merge branch 'main' into transaction
ChuckHend Sep 19, 2024
e57141f
feat:remove perform_transaction
tavallaie Sep 20, 2024
d2554f2
Merge branch 'transaction' of github.com:tavallaie/pgmq into transaction
tavallaie Sep 20, 2024
5d3b9c2
feat: adding example for transaction
tavallaie Sep 20, 2024
34f11bb
feat: update readme for using transactions
tavallaie Sep 20, 2024
5e92223
chore: linting
tavallaie Sep 20, 2024
bba66f4
chore: remove unused tnx variable
tavallaie Sep 20, 2024
895a468
feat: update examples for non-db and non-pgmq
tavallaie Sep 20, 2024
a95d5cb
Merge branch 'main' into transaction
ChuckHend Sep 28, 2024
e3900f1
chore: remove extra space in README
tavallaie Sep 28, 2024
2d67949
feat: complete async example app
tavallaie Sep 28, 2024
f0f4c4a
Merge branch 'transaction' of github.com:tavallaie/pgmq into transaction
tavallaie Sep 28, 2024
c4e5b51
chore: fixing some python code intention within README
tavallaie Sep 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions tembo-pgmq-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,53 @@ for metrics in all_metrics:
print(f"Scrape time: {metrics.scrape_time}")
```

### Using Transactions

#### Class-level Transactions

You can enable transactions at the class level by setting the `perform_transaction` attribute to `True`.

```python
queue.perform_transaction = True
```

#### Function-level Transactions

You can also enable transactions at the function level by passing `perform_transaction=True` to the method.

```python
queue.send("my_queue", {"hello": "world"}, perform_transaction=True)
```
or
```python
queue = PGMQueue(perform_transaction=True)
```

### Verbose Logging

Enable verbose logging by setting the `verbose` attribute to `True` when initializing the `PGMQueue` object.

```python
queue = PGMQueue(
host="0.0.0.0",
port="5432",
username="postgres",
password="postgres",
database="postgres",
verbose=True
)
```

Optionally, you can specify a custom log filename.

```python
queue = PGMQueue(
host="0.0.0.0",
port="5432",
username="postgres",
password="postgres",
database="postgres",
verbose=True,
log_filename="my_custom_log.log"
)
```
Loading
Loading