Skip to content

Commit

Permalink
fix: use DeclarativeBase - DIA-55287 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadrien committed May 5, 2023
1 parent 5810159 commit cca6a72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Fastapi-SQLA

[![codecov](https://codecov.io/gh/dialoguemd/fastapi-sqla/branch/master/graph/badge.svg?token=BQHLryClIn)](https://codecov.io/gh/dialoguemd/fastapi-sqla)
[![CircleCI](https://circleci.com/gh/dialoguemd/fastapi-sqla.svg?style=svg&circle-token=998482f269270ee521aa54f2accbee2e22943743)](https://circleci.com/gh/dialoguemd/fastapi-sqla)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/dialoguemd/fastapi-sqla/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/dialoguemd/fastapi-sqla/tree/master)
![PyPI](https://img.shields.io/pypi/v/fastapi-sqla)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-brightgreen.svg)](https://conventionalcommits.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Expand Down
6 changes: 4 additions & 2 deletions fastapi_sqla/sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
from fastapi_sqla import aws_aurora_support, aws_rds_iam_support

try:
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import DeclarativeBase
except ImportError:
from sqlalchemy.ext.declarative import declarative_base

DeclarativeBase = declarative_base() # type: ignore


logger = structlog.get_logger(__name__)

Expand Down Expand Up @@ -67,7 +69,7 @@ def startup():
logger.info("startup", engine=engine)


class Base(declarative_base(cls=DeferredReflection)): # type: ignore
class Base(DeclarativeBase, DeferredReflection):
__abstract__ = True


Expand Down

0 comments on commit cca6a72

Please sign in to comment.