confluentinc / confluentinc/confluent-sql

Add PEP-249-required no-op commit() (and rollback()) to Connection

Open
#224 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
1
Avg merge
21h 47m
Merged PRs (30d)
26

Description

Confluent Flink does not support transactions, so make that explicit in the driver:

```
@property
def autocommit(self) -> bool:
"""Always True: Confluent Cloud Flink statements have no transaction concept."""
return True

def commit(self) -> None:
"""No-op: Confluent Cloud Flink statements have no transaction concept to commit.

Provided for DB-API v2 compliance (PEP 249 requires this method even when the underlying
database has no transaction support) and so generic DB-API tooling (connection pools,
SQLAlchemy, notebook SQL magics, etc.) can call it unconditionally without special-casing
this driver.
"""
self._raise_if_closed_for_transaction_no_op() # match existing closed-connection semantics

def rollback(self) -> None:
"""No-op: there is nothing to roll back. See commit()."""
self._raise_if_closed_for_transaction_no_op()

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.