fix convert query results
This commit is contained in:
parent
da656d9582
commit
670f77722f
@ -22,10 +22,15 @@ logger.addHandler(handler)
|
||||
|
||||
def convert_query_result(query_res):
|
||||
"""Return List(elements) from query result List(Tuples(element))."""
|
||||
logger.debug("Converting %s", query_res)
|
||||
if len(query_res) == 0:
|
||||
logger.warning("Received empty result set from DB")
|
||||
return []
|
||||
return [list(i) for i in query_res] if len(query_res) > 1 else query_res[0][0]
|
||||
if len(query_res) == 1:
|
||||
res = list(query_res[0])
|
||||
else:
|
||||
res = [list(row) for row in query_res]
|
||||
return res
|
||||
|
||||
|
||||
class DbWrapper:
|
||||
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "pydb"
|
||||
version = "0.0.1"
|
||||
version = "0.0.3"
|
||||
authors = [
|
||||
{ name="Kyle Yasuda", email="suda@sudacode.com" },
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user