Search code examples
pythonunqlite

How to use primary and foreign key constraints?


I have started exploring unqlite database, but the issue is that I cannot find any solution for primary and foreign constrain. For primary key every record by default it creates _id key, but still I am not able to find any thing foreign key concept. If anyone could help me with code.


Solution

  • UnQLite is a key/value database engine, it doesn't support relations with foreign keys like relational database (e.g. MySQL). It also doesn't have indices. You can look up a value by key for O(1). If you need any filtering like WHERE queries in SQL, you need to iterate over all the keys or filter a collection with a Python function which is also iterating over all the collection.