I'm attempting to retrieve information from a postgreSQL database, a single column to be specific within which the data is stored in a 2D array format
example :
('user1', 'user2,'user3'),('user1', 'user2,'user3'),('user1', 'user2,'user3')
I'm extracting the values into a values_list using django's database abstraction interface
q = DBReports.objects.all().filter(name__contains = name1)
q = (q.values_list(columnName))
This then places all the values into a values_list, from this I need to extract two of the values from each list within the list, e.g user1 and user3 which are at array positions x,0,x,2 respectively, I am unable to determine how many lists within lists there will be, therefore I must iterate through the length
However I cannot convert the values_list to a 2D list, the following does not allow the code to be iteratable
list((q.values_list(columnName)))
And just returns a length of one, and all values in a single list.
Is there a way i can adequately extract this 2D list and place it into a 2D list within python?
Printed values are below (ignore all the '' its used later in the program)
[("[('user1', 'user2', 'user3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), ('user4', 'user5', 'user6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), ('user1', 'user3', 'user6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), ('user1', 'user2', 'user7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), ('user1', 'user2', 'user2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')]",)]