This series of tutorials shows you how to interact with databases like SQLite, MongoDB, MySQL, PostgreSQL by using Python modules like sqlite3, pymongo, mysql-connector-python, and psycopg2.
- 1Python sqlite3: How to establish/close a connection
- 2Python sqlite3: Setting a timeout for a connection
- 3Python sqlite3: Using cached statements
- 4Python sqlite3.ProgrammingError: parameters are of unsupported type
- 5Python sqlite3: Type Conversion (Implicit/Explicit)
- 6Python sqlite3 warning: ‘You can only execute one statement at a time’
- 7Python sqlite3 error: Numeric value out of range
- 8Python sqlite3 error: String or BLOB exceeds size limit
- 9Python sqlite3 error: The database path is not found
- 10Python sqlite3.OperationError: database is locked
- 11Python sqlite3.OperationError: Transaction failed
- 12Python sqlite3.IntegrityError: Foreign key check failed
- 13Python sqlite3.NotSupportedError: Causes & Solutions
- 14Python sqlite3: Understanding transactions and commit/rollback
- 15Python sqlite3: Using placeholders in SQL statements
- 16Python sqlite3: Insert a new row and get the ID
- 17Python sqlite3: How to perform bulk inserts
- 18Python sqlite3: Define a table with auto-incrementing primary key
- 19Python sqlite3 upsert: Update if exists, else insert
- 20Python sqlite3: How to set a connection runtime limit
- 21Python sqlite3: execute(), executescript(), and executemany() – Examples
- 22Python sqlite3: Understanding create_function() method (with examples)
- 23Python sqlite3 create_aggregate() method: Explanation with examples
- 24Python sqlite3 create_window_function() – Explanation with examples
- 25Python 3.11 – sqlite3 create_collation() method: Explanation with examples
- 26Python sqlite3 – iterdump() and backup() methods: Explanation with examples
- 27Python sqlite3: Serialize a database into bytes and deserialize it back
- 28Python sqlite3: fetchone(), fetchmany(), and fetchall() methods – Examples
- 29Python sqlite3: How to get a list of column names from a table
- 30Understanding sqlite3.Blob class in Python
- 31Python sqlite3: How to register adapters and converters
- 32Python sqlite3: How to open a database in read-only mode
- 33Python sqlite3: Pagination examples
- 34Python sqlite3: How to handle invalid UTF-8 encoding
- 35Python ModuleNotFoundError: No module named ‘_sqlite3’
- 36Python: Converting an SQLite database to JSON and vice versa
- 37Python: Converting an SQLite database to CSV and vice versa
- 38Python sqlite3: CRUD examples
- 39Python sqlite3: How to remove duplicates from a table
- 40Python sqlite3 aggregation: SUM, AVG, COUNT, MIN, and MAX
- 41Python sqlite3: Selecting/Counting Distinct Rows
- 42Python sqlite3: Choosing the right date time format
- 43Python sqlite3: Working with multiple databases
- 44PyMongo: How to establish/close a connection
- 45PyMongo: How to use a connection pool
- 46PyMongo: How to List All Databases
- 47PyMongo: How to list all collections in a database
- 48PyMongo: How to insert a document and get the ID
- 49PyMongo bulk insert: How to insert a list of documents/dicts
- 50PyMongo: How to get the latest/earliest document
- 51PyMongo: Using find_one() and find() methods
- 52PyMongo: How to count documents based on a condition
- 53PyMongo: How to sort documents based on a field (ASC, DESC)
- 54PyMongo: Sorting documents by multiple fields
- 55PyMongo: How to implement pagination
- 56PyMongo: How to select documents within a range
- 57Indexing in PyMongo: A Practical Guide
- 58PyMongo: How to execute raw database commands
- 59Python: Using sqlite3 with Type Hints
- 60Python sqlite3: Write a program to benchmark query execution time
- 61Python: Using PyMongo with Type Hints
- 62PyMongo: How to update and delete documents
- 63How to translate MongoDB shell syntax to PyMongo code
- 64PyMongo: How to use the aggregation pipeline (sum, avg, count, min, max)
- 65PyMongo: How to select/count distinct documents
- 66PyMongo: Updating specific array elements with array filters
- 67PyMongo: Query and update documents based on nested fields
- 68PyMongo: How to Define and Use Custom Types
- 69PyMongo: How to save datetime with timezone
- 70PyMongo: Grouping documents by day/month/year
- 71PyMongo: Saving and Querying Location Data (Latitude, Longitude)
- 72PyMongo: How to insert and update JSON data
- 73Solving PyMongo Error: Couldn’t connect to server 127.0.0.1:27017
- 74PyMongo: How to query documents with regex (regular expressions)
- 75PyMongo: How to simulate ‘LIKE’ and ‘ILIKE’ in SQL
- 76PyMongo: how to search documents by ObjectId
- 77PyMongo: How to find documents by a list of values
- 78PyMongo ValueError – Expecting property name: line 1 column 2 (char 1)
- 79PyMongo: How to convert ObjectId to string and vice versa
- 80PyMongo CursorNotFound error: Cursor not found/valid at server
- 81PyMongo: Why you need to close a connection?
- 82PyMongo error – Upsert failed: E11000 duplicate key error collection
- 83PyMongo error: Upsert must be an instance of dict, not str
- 84PyMongo Upsert Examples: Update if exists, else insert
- 85PyMongo error: Collection object is not callable
- 86PyMongo: Find documents with null/empty fields
- 87PyMongo: Convert query results to a list of dictionaries
- 88PyMongo: How to create/drop indexes
- 89PyMongo: How to create/drop databases
- 90PyMongo: Find documents within a day/week/month/year
- 91PyMongo: Find results within a specific area (geospatial queries)
- 92PyMongo ValueError: update only works with $ operators
- 93PyMongo: How to get the length of a cursor
- 94PyMongo: How to connect to a remote MongoDB server
- 95PyMongo Auth with username and password (examples)
- 96PyMongo: How to save and query ISODate
- 97PyMongo: How to exclude _id field from query results
- 98Solving Python ImportError: No module named ‘pymongo’
- 99PyMongo: How to check if a collection exists
- 100PyMongo: Removing specific fields from documents
- 101PyMongo: How to append values to an array field
- 102PyMongo error: Date time ‘…’ is not JSON serializable
- 103PyMongo: How to set a timeout for a connection
- 104PyMongo ImportError: Cannot import name BSON
- 105PyMongo: How to perform case-insensitive text search
- 106PyMongo ObjectId generation_time examples
- 107PyMongo error: Exceeded memory limit for $group, but didn’t allow external sort.
- 108PyMongo: How to create compound indexes
- 109PyMongo bson.errors.InvalidDocument: Cannot encode object
- 110PyMongo: Using $and, $or, $not, $nor operators (6 examples)
- 111How to check your PyMongo version and upgrade it
- 112Fixing BulkWriteError: batch op errors occurred
- 113MongoEngine: How to connect to a database
- 114MongoEngine: How to use multiple databases
- 115MongoEngine: How to define document’s schema
- 116MongoEngine: Working with ListField
- 117MongoEngine – Working with EnumField
- 118MongoEngine – Using ImageField and FileField
- 119MongoEngine Indexing: A Practical Guide
- 120MongoEngine Document Validation: The Complete Guide
- 121MongoEngine: Sorting Documents – Tutorial & Examples
- 122MongoEngine: CRUD Operations – Tutorial & Examples
- 123MongoEngine: How to Perform Text Search
- 124MongoEngine Pagination – Tutorial & Examples
- 125MongoEngine: How to ignore a field when validating documents
- 126MongoEngine: How to exclude fields from query results
- 127MongoEngine: How to insert one or multiple documents
- 128MongoEngine: How to update a document by ID
- 129MongoEngine: How to delete documents by a condition
- 130MongoEngine Upsert: Insert if not exists, update if exists
- 131MongoEngine: AND & OR Conditions – Tutorial & Examples
- 132MongoEngine: Filter Documents by Multiple Fields
- 133MongoEngine: How to update embedded documents
- 134MongoEngine: How to convert a document to JSON
- 135Using Regular Expressions in MongoEngine
- 136MongoEngine ConnectionError: You have not defined a default connection
- 137MongoEngine: Fetch the latest/earliest document
- 138MongoEngine: How to create/drop a collection
- 139MongoEngine: How to close a connection
- 140MongoEngine Aggregation: A Practical Guide
- 141MongoEngine: How to query distinct values
- 142MongoEngine: Set a default value for a field
- 143MongoEngine: Required and Optional Fields
- 144MongoEngine: Set max length for a text field
- 145MongoEngine: Set min/max for a number field
- 146MongoEngine: Unique and Non-Unique Fields
- 147MongoEngine: How to see the generated query
- 148MongoEngine ReferenceField – Tutorial & Examples
- 149MongoEngine: How to append item to a ListField
- 150MongoEngine DateTimeField – Tutorial & Examples
- 151MongoEngine BinaryField – Tutorial & Examples
- 152MongoEngine DictField: A Practical Guide (with examples)