Skip to content

Commit fbfa276

Browse files
committed
rename
1 parent 3ede142 commit fbfa276

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/postgres-database/src/simcore_postgres_database/utils_repos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@asynccontextmanager
11-
async def get_or_create_connection(
11+
async def pass_or_acquire_connection(
1212
engine: AsyncEngine, connection: AsyncConnection | None = None
1313
) -> AsyncIterator[AsyncConnection]:
1414
# NOTE: When connection is passed, the engine is actually not needed
@@ -30,7 +30,7 @@ async def get_or_create_connection(
3030
async def transaction_context(
3131
engine: AsyncEngine, connection: AsyncConnection | None = None
3232
):
33-
async with get_or_create_connection(engine, connection) as conn:
33+
async with pass_or_acquire_connection(engine, connection) as conn:
3434
if conn.in_transaction():
3535
async with conn.begin_nested(): # inner transaction (savepoint)
3636
yield conn

packages/postgres-database/tests/test_utils_repos.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sqlalchemy as sa
1111
from simcore_postgres_database.models.tags import tags
1212
from simcore_postgres_database.utils_repos import (
13-
get_or_create_connection,
13+
pass_or_acquire_connection,
1414
transaction_context,
1515
)
1616
from sqlalchemy.exc import IntegrityError
@@ -100,7 +100,7 @@ async def get_by_id(
100100
*,
101101
row_id: int,
102102
) -> dict[str, Any] | None:
103-
async with get_or_create_connection(self.engine, connection) as conn:
103+
async with pass_or_acquire_connection(self.engine, connection) as conn:
104104
result = await conn.execute(
105105
sa.select(self.table).where(self.table.c.id == row_id)
106106
)
@@ -114,7 +114,7 @@ async def get_page(
114114
limit: int,
115115
offset: int = 0,
116116
) -> _PageTuple:
117-
async with get_or_create_connection(self.engine, connection) as conn:
117+
async with pass_or_acquire_connection(self.engine, connection) as conn:
118118
# Compute total count
119119
total_count_query = sa.select(sa.func.count()).select_from(self.table)
120120
total_count_result = await conn.execute(total_count_query)

0 commit comments

Comments
 (0)