Reputation: 1485
I have a table of file information in my DB I am trying to query and return the file_path column of the result as list of string.
My code looks like below
path_found = session.query(db.file_table.path).filter([filters]).all()
It returns a list of sqlalchemy.util._collections.result instead of list of string.
Is there any way to get the query result as a list of string?
Upvotes: 2
Views: 3017
Reputation: 9
Here is the Example Code:
query = session.query(Region.name).all()
query = map(lambda t: t[0], query)
query = list(query)
print(query)
Upvotes: 1