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 gt,gt,in, or;update with or; \text{update with}\ set, inc ,\text{inc}\ ,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.
Read the full Python MongoDB & SQLite notes on Doubtclip →