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

SQLAlchemy 1.4 #81

Merged
merged 11 commits into from
Dec 7, 2023
31 changes: 7 additions & 24 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ jobs:
strategy:
fail-fast: false
matrix:
debian-version: [ '10', '11' ]
sqlalchemy-version: [ '1.3', '1.4' ]
debian-version: [ '11', '12' ]
sqlalchemy-version: [ '1.4' ]
include:
- debian-version: '10'
python-version: '3.7'
postgres-version: '11-stretch'
- debian-version: '11'
python-version: '3.9'
postgres-version: '13-bullseye'
exclude:
- debian-version: '10'
sqlalchemy-version: '1.3'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15-bookworm'

name: Debian ${{ matrix.debian-version }} - SQLAlchemy ${{ matrix.sqlalchemy-version }}

Expand Down Expand Up @@ -60,26 +57,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.3' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
pytest-cov \
-e .[tests] \
-e file:dependencies/Utils-Flask-SQLAlchemy#egg=utils-flask-sqlalchemy \
"sqlalchemy<1.4" \
"flask-sqlalchemy<3"\
"flask-marshmallow<0.15"
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.4' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
pytest-cov \
-e .[tests] \
-e file:dependencies/Utils-Flask-SQLAlchemy#egg=utils-flask-sqlalchemy \
"sqlalchemy<2,>=1.4" \
"flask-sqlalchemy>=3"
-e file:dependencies/Utils-Flask-SQLAlchemy#egg=utils-flask-sqlalchemy
- name: Install database
run: |
alembic upgrade utilisateurs@head
Expand All @@ -91,7 +74,7 @@ jobs:
env:
USERSHUB_AUTH_MODULE_SETTINGS: test_settings.py
- name: Upload coverage to Codecov
if: ${{ matrix.debian-version == '11' }}
if: ${{ matrix.debian-version == '12' }}
uses: codecov/codecov-action@v3
with:
flags: pytest
6 changes: 2 additions & 4 deletions requirements-common.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
authlib
bcrypt
flask-sqlalchemy
# pytest flask is incompatible with flask 3
flask < 3
flask < 4
flask-login
psycopg2
requests
sqlalchemy>=1.3,<2
sqlalchemy>=1.4,<2
flask-marshmallow
marshmallow-sqlalchemy
alembic
# for flask login
werkzeug<3
4 changes: 2 additions & 2 deletions src/pypnusershub/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class User(db.Model, UserMixin):
secondary=cor_roles,
primaryjoin="User.id_role == utilisateurs.cor_roles.c.id_role_utilisateur",
secondaryjoin="User.id_role == utilisateurs.cor_roles.c.id_role_groupe",
backref=backref("members"),
backref=backref("members", cascade_backrefs=False),
)

@property
Expand Down Expand Up @@ -213,7 +213,7 @@ class Organisme(db.Model):
__table_args__ = {"schema": "utilisateurs"}

id_organisme = db.Column(db.Integer, primary_key=True)
uuid_organisme = db.Column(UUID(as_uuid=True), default=select([func.uuid_generate_v4()]))
uuid_organisme = db.Column(UUID(as_uuid=True), default=select(func.uuid_generate_v4()))
nom_organisme = db.Column(db.Unicode)
adresse_organisme = db.Column(db.Unicode)
cp_organisme = db.Column(db.Unicode)
Expand Down
13 changes: 2 additions & 11 deletions src/pypnusershub/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,9 @@
import logging

import datetime
from markupsafe import escape
from flask import (
Blueprint,
request,
Response,
current_app,
redirect,
g,
make_response,
jsonify,
)
from flask_login import login_user, logout_user, current_user
from flask import Blueprint, request, Response, current_app, redirect, g, make_response, jsonify
from markupsafe import escape

from sqlalchemy.orm import exc
import sqlalchemy as sa
Expand Down