Skip to content

Sync python-sqlite-sqlalchemy with the updated tutorial - #947

Merged
realpython-bot merged 1 commit into
masterfrom
maintenance/python-sqlite-sqlalchemy-20261118
Nov 18, 2026
Merged

realpython-bot merged 1 commit into
masterfrom
maintenance/python-sqlite-sqlalchemy-20261118

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Syncs python-sqlite-sqlalchemy/ with the maintenance update of Data Management With Python, SQLite, and SQLAlchemy.

What changed and why

  • project/examples/example_1/main.py: add_new_book() now uses pd.concat() instead of DataFrame.append(), which was removed in pandas 2.0 and raised AttributeError.
  • project/modules/models.py: imports declarative_base from sqlalchemy.orm instead of the deprecated sqlalchemy.ext.declarative.
  • setup.py: every dependency is now pinned with == to its current release (pandas 3.1.1, SQLAlchemy 2.1.9, treelib 1.8.0, Flask 3.1.3, Flask-SQLAlchemy 3.1.1, Flask-Cors 6.0.5, Flask-WTF 1.3.0, python-dateutil 4.0.0, python-dotenv 1.2.4; Flask-Bootstrap4 stays at 4.0.2, the latest release). treelib was previously unpinned. Adds python_requires=">=3.11", the floor that pandas 3 and SQLAlchemy 2.1 need.
  • README.md: Python version updated from 3.8.0 to 3.15.2, and states the 3.11 floor.

These changes match the article draft: https://realpython.com/pbjt/blog/post/2656/change/
Maintenance card: https://trello.com/c/kkoQgDkb

Verification

On Python 3.15.2, in a fresh venv set up with python -m pip install -e . (the README's route):

  • python -m project.examples.example_1.main: output matches the article's console listing.
  • python -m project.examples.example_2.main and python -m project.build_data.build_author_book_publisher_sqlite both run cleanly.
  • examples/example_3 (Flask): every GET route returned 200 through the Flask test client, run with -W error::DeprecationWarning. Creating an artist and an album through POST worked as well.
  • ruff@0.14.1 format --check and ruff check both pass on the folder.

Note: uv pip install -e . fails on the folder because setup.cfg names the package local_project while setup.py names it project. This was already the case before this PR, which leaves it alone. pip handles it.

🤖 Generated with Claude Code

…agement With Python, SQLite, and SQLAlchemy

- Replace DataFrame.append() (removed in pandas 2.0) with pd.concat() in example_1
- Import declarative_base from sqlalchemy.orm (sqlalchemy.ext.declarative is deprecated)
- Pin every dependency in setup.py to current releases and require Python 3.11+
- Update README Python version

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realpython-bot
realpython-bot merged commit 2fbc923 into master Nov 18, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/python-sqlite-sqlalchemy-20261118 branch November 18, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant