Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration to sqlalchemy 2.0 #563

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
60318b4
migration to sqlalchemy 2.0
farahats9 Mar 7, 2023
48ddc61
fix some linting errors
farahats9 Mar 24, 2023
b48423f
remove unused imports
farahats9 Mar 24, 2023
9c219d9
Update sqlmodel/sql/expression.py
farahats9 Mar 31, 2023
37ed979
reflecting python 3.6 deprecation in docs and tests
farahats9 Mar 31, 2023
0eee8e8
Merge branch 'main' of https://github.com/farahats9/sqlmodel
farahats9 Mar 31, 2023
050cf02
resolving @sbor23 comments
farahats9 Mar 31, 2023
fbff99c
add the new Subquery class
farahats9 Apr 30, 2023
6d8f527
update to latest sqlalchemy version
farahats9 Apr 30, 2023
4ce8d07
fix jinja2 template
farahats9 Apr 30, 2023
ecfb321
`Result` expects a type `Tuple[_T]`
peterlandry Jul 26, 2023
3738a7f
Remove unused type ignore
peterlandry Jul 26, 2023
814988b
Result seems well enough typed in SqlAlchemy now we can simply shim over
peterlandry Jul 26, 2023
118ca33
Implicit export of ForwardRef was remove in pydantic
peterlandry Jul 26, 2023
9170729
_Select expects a `Tuple[Any, ...]`
peterlandry Jul 26, 2023
7f5ba1c
Use Dict type instead of Mapping for SqlAlchemy compat
peterlandry Jul 26, 2023
e942e5e
Execution options are not Optional in SA
peterlandry Jul 26, 2023
ef9f00a
Another instance of non-optional execution_options
peterlandry Jul 26, 2023
643cea5
Fix Tuple in jinja template as well
peterlandry Jul 26, 2023
b89adbb
Use ForUpdateArg from sqlalchemy
peterlandry Jul 26, 2023
eff0803
Fix signature for `Session.get`
peterlandry Jul 26, 2023
c5bdbcc
Merge pull request #2 from peterlandry/main
farahats9 Jul 27, 2023
1752f0b
formatting and remove unused type
farahats9 Jul 27, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6.15", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false

steps:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: python -m poetry install
- name: Lint
if: ${{ matrix.python-version != '3.6.15' }}
if: ${{ matrix.python-version != '3.7' }}
farahats9 marked this conversation as resolved.
Show resolved Hide resolved
run: python -m poetry run bash scripts/lint.sh
- run: mkdir coverage
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as

## Requirements

A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.6 and above</a>).
A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.7 and above</a>).

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you already cloned the repository and you know that you need to deep dive in

### Python

SQLModel supports Python 3.6 and above, but for development you should have at least **Python 3.7**.
SQLModel supports Python 3.7 and above, but for development you should have at least **Python 3.7**.
farahats9 marked this conversation as resolved.
Show resolved Hide resolved

### Poetry

Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Nevertheless, SQLModel is completely **independent** of FastAPI and can be used

## Just Modern Python

It's all based on standard <abbr title="Python currently supported versions, 3.6 and above.">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.
It's all based on standard <abbr title="Python currently supported versions, 3.7 and above.">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.

If you need a 2 minute refresher of how to use Python types (even if you don't use SQLModel or FastAPI), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">Python types intro</a>.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as

## Requirements

A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.6 and above</a>).
A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.7 and above</a>).

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

Expand Down
3 changes: 1 addition & 2 deletions docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $ cd sqlmodel-tutorial

Make sure you have an officially supported version of Python.

Currently it is **Python 3.6** and above (Python 3.5 was already deprecated).
Currently it is **Python 3.7** and above (Python 3.6 was already deprecated).

You can check which version you have with:

Expand All @@ -85,7 +85,6 @@ You might want to try with the specific versions, for example with:
* `python3.9`
* `python3.8`
* `python3.7`
* `python3.6`
farahats9 marked this conversation as resolved.
Show resolved Hide resolved

The code would look like this:

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Internet",
Expand Down Expand Up @@ -48,8 +50,8 @@ fastapi = "^0.68.1"
requests = "^2.26.0"
autoflake = "^1.4"
isort = "^5.9.3"
async_generator = {version = "*", python = "~3.6"}
async-exit-stack = {version = "*", python = "~3.6"}
async_generator = {version = "*", python = "~3.7"}
async-exit-stack = {version = "*", python = "~3.7"}

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 0 additions & 2 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ mypy sqlmodel
flake8 sqlmodel tests docs_src
black sqlmodel tests docs_src --check
isort sqlmodel tests docs_src scripts --check-only
# TODO: move this to test.sh after deprecating Python 3.6
CHECK_JINJA=1 python scripts/generate_select.py
1 change: 1 addition & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e
set -x

CHECK_JINJA=1 python scripts/generate_select.py
coverage run -m pytest tests
coverage combine
coverage report --show-missing
Expand Down