Merge pull request #34 from grillazz/onboard-alembic😉

python 3.10 improvements
This commit is contained in:
Jakub Miazek 2022-05-15 14:07:36 +02:00 committed by GitHub
commit 51409707e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"] python-version: ["3.9", "3.10"]
fail-fast: false fail-fast: false
services: services:
sqldb: sqldb:
image: postgres:13 image: postgres:14
env: env:
POSTGRES_USER: user POSTGRES_USER: user
POSTGRES_PASSWORD: secret POSTGRES_PASSWORD: secret

View File

@ -1,5 +1,5 @@
# pull official base image # pull official base image
FROM postgres:13-alpine FROM postgres:14-alpine
# run create.sql on init # run create.sql on init
ADD create.sql /docker-entrypoint-initdb.d ADD create.sql /docker-entrypoint-initdb.d

View File

@ -1,5 +1,3 @@
from typing import List
from fastapi import APIRouter, Depends, HTTPException, status from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
@ -15,7 +13,7 @@ logger = get_logger(__name__)
@router.post("/add_many", status_code=status.HTTP_201_CREATED) @router.post("/add_many", status_code=status.HTTP_201_CREATED)
async def create_multi_stuff(payload: List[StuffSchema], db_session: AsyncSession = Depends(get_db)): async def create_multi_stuff(payload: list[StuffSchema], db_session: AsyncSession = Depends(get_db)):
try: try:
stuff_instances = [Stuff(name=stuf.name, description=stuf.description) for stuf in payload] stuff_instances = [Stuff(name=stuf.name, description=stuf.description) for stuf in payload]
db_session.add_all(stuff_instances) db_session.add_all(stuff_instances)

View File

@ -1,3 +1,3 @@
from the_app.models.nonsense import Nonsense # noqa from the_app.models.nonsense import Nonsense # noqa
from the_app.models.stuff import Stuff # noqa
from the_app.models.shakespeare import Character # noqa from the_app.models.shakespeare import Character # noqa
from the_app.models.stuff import Stuff # noqa