I have read similar articles on SO and found none where this is applicable, to this extent.
I have a SQL db where I am storing specific information.
Different scripts populate selective columns.
I want to know how I can view only the populated columns upon query and not return the NULL values, nor respective columns in the row queried.
with sqlite3.connect('Test.sql3') as conn:
cursor = conn.cursor()
cursor.execute('SELECT * FROM Table WHERE Item=?', (car,))
results = cursor.fetchall()
item_0_in_result = [_[0] for _ in results]
item_0_in_result1 = [_[1] for _ in results]
item_0_in_result2 = [_[2] for _ in results]
In this query the results can be more, or less items based on the populated columns.
This script should then only return the columns with respective values upon query.
I am sure that this can be achieved with a type of array based query, but with the variation of columns I seem to be a bit stuck.