diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2023-04-21 18:57:01 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2023-04-21 18:57:01 +0000 |
| commit | 69ba6e3cf771dce93b18350ab6b4a4ab79604b40 (patch) | |
| tree | 897cd37c92d52f118c3ce05eefc511309cb5d751 /test/dialect/postgresql | |
| parent | c84b3bf198c75ad4f42b0f83d482e480200e6d16 (diff) | |
| parent | 244c29768254d12ff18bb342b154a009080345d6 (diff) | |
| download | sqlalchemy-69ba6e3cf771dce93b18350ab6b4a4ab79604b40.tar.gz | |
Merge "Add name_func optional attribute for asyncpg adapter" into main
Diffstat (limited to 'test/dialect/postgresql')
| -rw-r--r-- | test/dialect/postgresql/test_async_pg_py3k.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_async_pg_py3k.py b/test/dialect/postgresql/test_async_pg_py3k.py index d9116a7ce..49014fcaf 100644 --- a/test/dialect/postgresql/test_async_pg_py3k.py +++ b/test/dialect/postgresql/test_async_pg_py3k.py @@ -1,4 +1,5 @@ import random +import uuid from sqlalchemy import Column from sqlalchemy import exc @@ -272,3 +273,19 @@ class AsyncPgTest(fixtures.TestBase): await conn.close() eq_(codec_meth.mock_calls, [mock.call(adapted_conn)]) + + @async_test + async def test_name_connection_func(self, metadata, async_testing_engine): + cache = [] + + def name_f(): + name = str(uuid.uuid4()) + cache.append(name) + return name + + engine = async_testing_engine( + options={"connect_args": {"prepared_statement_name_func": name_f}}, + ) + async with engine.begin() as conn: + await conn.execute(select(1)) + assert len(cache) > 0 |
