I have a TinyDB for Python and the data with multiple lines in the structure
{'service': {'key1': '', 'key2': '', 'key3': '', 'key4': '', 'key5': ''}}
I wanted to get only "service" from all the lines of the database assuming the "service" real name is not known.
How to achieve with tinyDB Query()?
db.all()[0]
just give entire line in index 0.
I am expecting to get only "service".
It's a bit tricky:
>>> list(db.all()[0].keys())[0]
service
>>> list(db.all()[0].values())
[{'key1': '', 'key2': '', 'key3': '', 'key4': '', 'key5': ''}]