Reputation: 111
I have been given a few TSV files containing data, around 800MB total in a couple of files. Each of them has columns that link up with columns in another file.
I have so far imported all of my data into Python and stored it in an array. I now need to find a way to build a database out of this data without using any SQL, NoSQL, etc.
In the end I will be performing SQL-like queries on it (without SQL) and performing OLAP operations on the data. I can also NOT use any external libraries.
After doing some research, I have came across using dictionaries as a way to do this project, but I am not sure how to go about linking the tables together with dictionary. Would it be a list of dictionaries?
Upvotes: 1
Views: 120
Reputation: 7743
Yes, you could fake a lot of DB operations with a nested dict structure. Top level is your "tables", each table has entries (use a "primary key" on these) and each entry is a dict of key:value pairs where keys are "column names" and values are, well, values.
You could even write a little sql-like query language on this if you wanted, but you'd want to start by writing some code to manage this. You don't want to be building this DB freehand, it'll be important to define the operations as code. For example, insert should deal with enforcing value restrictions and imposing defaults and setting auto-incrementing keys and so forth (if you really want to be "performing sql like queries" against it)
Upvotes: 1