TinyDB compound queries to multiple namespaces

If I wanted to create a TinyDB database for a car collection, I'm having trouble figuring how TinyDB uses queries with different namespaces (the namespaces acting as sudo 'Tables').

For example I would want to record a car color, engine type, transmission type, etc. From what I've read about TinyDB, I could create a namespace for color, a namespace for engine type, and so on. But .StoreValue only gives me one tag to use.

If I have 4 cars in my collection that are red, how do I initiate a find on the red 1965 Ford Mustang record so I can update it's new radio? I don't see that TinyDB gives me that capability. I can display all the red cars in my collection but one of the most often used features of a database is to find one specific record in the target Table. And that's often done using multiple/compound queries (AND, OR).

If TinyDB can do specific finds to get to a record of a red 1965 Ford Mustang, it got pass me!! I'm thinking I would need to query multiple namespaces to do that.

If I use the license plate number as a master index for each car. I can find any plate in the license plate namespace. So far so good. But now, how do I narrow down to find out the color and other parameters of that specific car in the other namespaces? In all the other namespaces, their Tags are all used for other purposes such as Color:Red. How do I tie those records to a specific license plate? Thank you.

Sounds like it would be better to use sqlite, or an online database?

That's what I'm starting to think.

I provided this demo a while ago, maybe this will help?

Thank you.

For a simple to use sqlite extension, which follows the kiss principle - keep it simple stupid

There are also other sqlite extensions available
Taifun

You can simulate SQL selects if you set up a TinyDB namespace pair for every column of the car table, keyed by VIN.

Then pipe list filter calls against the TinyDB dictionary dumping block of each attribute in your SQL Where clause.

Blocks to follow after breakfast...

Here's an alternative approach I had in stock, using dictionaries as the tag values:

I'll take a moment to add a search facility.

Yes, you could do that, but why not just sending a simple query to the sqlite database like this

Select * from myTable 
where licensePlateNumber = xyz

Taifun

SQLite is fine, if you don't mind extensions (Android Only)

While I have more experience with SQL, TinyDB is extremely simple and can do the job for data storage that isn't too complex.

I can decide on which storage system to go with once I figure out the data structure for my basic app. Next up is for me is to dig into the data structure of Android/Samsung SMS Msg file(s). Once I know how complex or simple this structure is, I'll be able to pick the DB engine to use.
Thank you BOTH for your time and advice. @ABG thank you for the sample files which I will look at regardless.

I misnamed my project.
It turned out it was based on lists of pairs, not dictionaries, to preserve pair order.

Here's a version with filtered lookups.


TinyDB_Contact_PairLists_Filtered.aia (10.2 KB)

Thank you again.