SQLAlchemy Tutorials: From Basic to Advanced

This series of tutorials helps you learn SQLAlchemy from basic to advanced. We will explore the core concepts of the library, and walk though several code examples of implementing them in practices.

1 How to set up SQLAlchemy in your Python projects

2 SQLAlchemy: 2 Ways to Connect to SQLite Database

3 SQLAlchemy: 3 Ways to Connect to PostgreSQL Database

4 SQLAlchemy: How to Connect to MySQL Database

5 SQLAlchemy: How to Connect to Multiple Databases Concurrently

6 Understanding SQLAlchemy Core and ORM

7 Primitive Data Types in SQLAlchemy

8 Understanding Metadata in SQLAlchemy

9 SQLAlchemy: How to Create a Table (Basic & Advanced)

10 SQLAlchemy: Creating a Table with Auto-Incrementing ID

11 How to Set Index in SQLAlchemy

12 How to Set Unique Columns in SQLAlchemy

13 SQLAlchemy: How to Insert a Record into a Table

14 SQLAlchemy: How to Bulk Insert Data into a Table

15 SQLAlchemy: How to Remove FOREIGN KEY Constraints (2 Ways)

16 SQLAlchemy: How to Update a Record by ID

17 SQLAlchemy: How to Delete a Record by ID

18 SQLAlchemy Upsert: Update if Exists, Insert if Not

19 How to Safely Alter a Table in SQLAlchemy

20 SQLAlchemy: Singular vs Plural Table Names

21 SQLAlchemy: How to Rename a Table

22 SQLAlchemy: How to Rename a Column

23 SQLAlchemy: How to safely update a model in production

24 SQLAlchemy: Data Migration in Production

25 SQLAlchemy: How to Add/Remove a Primary Key Constraint

26 SQLAlchemy: How to Drop a Table

27 SQLAlchemy: Designing a Shortened URL Service Database

28 SQLAlchemy: Designing a Social Network Database Schema

29 SQLAlchemy: How to Empty/Truncate a Table

30 SQLAlchemy: How to Add/Remove a Column

31 SQLAlchemy: Designing an online shopping database schema

32 Exploring One-to-Many Relationships in SQLAlchemy

33 How to Set Unsigned Integer Field in SQLAlchemy

34 SQLAlchemy: How to Use Many-To-Many Relationships

35 SQLAlchemy: Delete Related Objects with Cascade

36 How to Use ENUM in SQLAlchemy

37 SQLAlchemy: created_at and updated_at columns

38 AND & OR Operators in SQLAlchemy

39 How to use LIKE operator in SQLAlchemy

40 SQLAlchemy: Resetting the auto-increment value of a column

41 How to use IN and NOT IN operators in SQLAlchemy

42 SQLAlchemy: How to Sort Query Results (ASC, DESC)

43 SQLAlchemy: How to Sort Results by Multiple Columns

44 SQLAlchemy: How to Sort Results by Date Column

45 SQLAlchemy: OFFSET and LIMIT Clauses

46 How to execute raw SQL in SQLAlchemy

47 SQLAlchemy: How to use GROUP BY with COUNT(*)

48 SQLAlchemy GROUP BY: A Comprehensive Guide

49 How to count rows in SQLAlchemy

50 How to Use Regular Expressions in SQLAlchemy

51 SQLAlchemy: Ways to Find Results by a Keyword

52 SQLAlchemy: Select Results with a List of IDs

53 How to Select Distinct Rows in SQLAlchemy

54 How to Count Distinct Rows in SQLAlchemy

55 SQLAlchemy Aggregation: Min, Max, Average, and Sum

56 SQLAlchemy: Select Rows Between Two Dates

57 SQLAlchemy: Select Records Older Than a Given Time

58 SQLAlchemy: Select Records in Last Day, Week, or Month



61 SQLAlchemy: Serializing Query Results into JSON

62 SQLAlchemy: How to Exclude Password from Results

63 SQLAlchemy: Excluding Specific Columns from Query Results

64 SQLAlchemy: Convert Query Results into a DataFrame

65 SQLAlchemy: Convert Query Results into Dictionary

66 SQLAlchemy: How to See the Generated SQL

67 SQLAlchemy: Select rows where column is not null

68 SQLAlchemy: Select rows where column is Null or empty

69 SQLAlchemy: How to store datetime with timezone

70 How to filter results by multiple columns in SQLAlchemy

71 How to execute subqueries in SQLAlchemy

72 How to enable/disable caching in SQLAlchemy

73 How to enable/disable auto-commit in SQLAlchemy

74 SQLAlchemy: Perform Case-Insensitive Filter

75 SQLAlchemy: How to Set a Timeout for Queries (Max Execution Time)

76 How to Save a Python Dictionary in SQLAlchemy

77 How to Save a Python List in SQLAlchemy

78 How to store JSON data in SQLAlchemy

79 Weighted Random Selection in SQLAlchemy: An In-Depth Guide

80 SQLAlchemy: How to Automatically Delete Old Records

81 SQLAlchemy: How to Create and Use Temporary Tables

82 SQLAlchemy: Counting rows for each category (2 approaches)

83 SQLAlchemy: Get the ID of the Last Inserted Row

84 SQLAlchemy: Get a list of all tables

85 SQLAlchemy: Saving Categories and Subcategories in the Same Table

86 SQLAlchemy error: 'dict' object does not support indexing

87 SQLAlchemy: How to Filter by Related Fields

88 SQLAlchemy: Group by day, week, month, year etc.

89 How to enable/disable logging in SQLAlchemy

90 How to Set Default Value for a Column in SQLAlchemy

91 How to Save CSV Data in SQLAlchemy

92 Using multiple foreign keys in SQLAlchemy


94 How to use DATEADD in SQLAlchemy

95 Fixing SQLAlchemy Error - MissingGreenlet: greenlet_spawn not called

96 How to get a random row in SQLAlchemy

97 How to retrieve N random rows in SQLAlchemy

98 How to get the Nth row in SQLAlchemy

99 How to Get the First Row in SQLAlchemy

100 How to Implement Pagination in SQLAlchemy

101 How to use Pydantic with SQLAlchemy

102 Using SQLAlchemy with the 'with' statement

103 Dealing with Errors in SQLAlchemy - A Developer's Guide

104 How to prevent SQL injection in SQLAlchemy

105 How to Use Column Aliases in SQLAlchemy

106 How to listen for events in SQLAlchemy

107 How to select rows where a column is Null in SQLAlchemy

108 SQLAlchemy: What if you don't close database connections?

109 SQLAlchemy Composite Indexes: The Complete Guide

110 Full-Text Search in SQLAlchemy: The Ultimate Guide

111 SQLAlchemy: How to temporarily delete a row

112 SQLAlchemy: Grouping data on multiple columns

113 SQLAlchemy: Adding a calculated column to SELECT query

Notify of
Inline Feedbacks
View all comments