This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ def __init__(
9494 self ._column_map_int [idx ] = (idx , datatype )
9595 self ._column_map_full [str (column [0 ])] = (idx , datatype )
9696
97+ def values (self ) -> typing .ValuesView :
98+ return self ._row .values ()
99+
97100 def __getitem__ (self , key : typing .Any ) -> typing .Any :
98101 if len (self ._column_map ) == 0 : # raw query
99102 return self ._row [tuple (self ._row .keys ()).index (key )]
Original file line number Diff line number Diff line change @@ -278,6 +278,22 @@ async def test_results_support_column_reference(database_url):
278278 assert results [0 ][custom_date .c .published ] == today
279279
280280
281+ @pytest .mark .parametrize ("database_url" , DATABASE_URLS )
282+ @async_adapter
283+ async def test_result_values_allow_duplicate_names (database_url ):
284+ """
285+ The values of a result should respect when two columns are selected
286+ with the same name.
287+ """
288+ async with Database (database_url ) as database :
289+ async with database .transaction (force_rollback = True ):
290+ query = "SELECT 1 AS id, 2 AS id"
291+ row = await database .fetch_one (query = query )
292+
293+ assert list (row .keys ()) == ["id" , "id" ]
294+ assert list (row .values ()) == [1 , 2 ]
295+
296+
281297@pytest .mark .parametrize ("database_url" , DATABASE_URLS )
282298@async_adapter
283299async def test_fetch_one_returning_no_results (database_url ):
You can’t perform that action at this time.
0 commit comments