Python Tutorial · Revision notes
Python MongoDB & SQLite
MongoDB stores flexible JSON-like documents and is accessed with pymongo. SQLite is a zero-configuration, file-based SQL database that ships inside Python as the sqlite3 module. Together they cover document and relational storage without heavy infrastructure.
Quick revision
- MongoDB: client -> database -> collection -> documents (dicts).
- find / find_one with in, set, push.
- create_index(unique=True) prevents duplicates; aggregate for analytics.
- sqlite3 is built in; ? placeholders; commit() to save.
- with conn commits/rolls back but does not close.
- PRAGMA foreign_keys = ON to enforce foreign keys.