Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python-sqlite-sqlalchemy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ This repository contains the content and example code
for the Python / SQLite / SQLAlchemy article I'm writing
for Real Python.

This project was built using Python 3.8.0
This project was built using Python 3.15.2 and requires Python 3.11 or later.

## Python Virtualenv

I use the `pyenv` tool to install Python versions on my Mac. I find it a very useful tool, and the instructions that follow use it, and are based on having Python version 3.8.0 installed using the following command:
I use the `pyenv` tool to install Python versions on my Mac. I find it a very useful tool, and the instructions that follow use it, and are based on having Python version 3.15.2 installed using the following command:

```shell
$ pyenv install 3.8.0
$ pyenv install 3.15.2
```

## Installing The Project

From the main folder take the following steps (on a Mac):

* Install a Python virtual environment for this project
* `pyenv local 3.8.0`
* `pyenv local 3.15.2`
* `python -m venv .venv`
* Activate the virtual environment
* `source .venv/bin/activate`
Expand Down
21 changes: 14 additions & 7 deletions python-sqlite-sqlalchemy/project/examples/example_1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@ def add_new_book(data, author_name, book_title, publisher_name):
):
return data
# Add the new book
return data.append(
{
"first_name": first_name,
"last_name": last_name,
"title": book_title,
"publisher": publisher_name,
},
return pd.concat(
[
data,
pd.DataFrame(
[
{
"first_name": first_name,
"last_name": last_name,
"title": book_title,
"publisher": publisher_name,
}
]
),
],
ignore_index=True,
)

Expand Down
2 changes: 1 addition & 1 deletion python-sqlite-sqlalchemy/project/modules/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sqlalchemy import Column, ForeignKey, Integer, String, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import backref, relationship

Base = declarative_base()
Expand Down
19 changes: 10 additions & 9 deletions python-sqlite-sqlalchemy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
name="project",
version="1.0",
packages=find_packages(),
python_requires=">=3.11",
install_requires=[
"pandas==1.0.3",
"Flask==1.1.1",
"SQLAlchemy==1.3.13",
"Flask-SQLAlchemy==2.4.1",
"Flask-Cors==3.0.8",
"pandas==3.1.1",
"Flask==3.1.3",
"SQLAlchemy==2.1.9",
"Flask-SQLAlchemy==3.1.1",
"Flask-Cors==6.0.5",
"Flask-Bootstrap4==4.0.2",
"Flask-WTF==0.14.3",
"python-dateutil==2.8.1",
"python-dotenv==0.10.5",
"treelib",
"Flask-WTF==1.3.0",
"python-dateutil==4.0.0",
"python-dotenv==1.2.4",
"treelib==1.8.0",
],
)
Loading