Skip to content

Commit cca6a72

Browse files
authored
fix: use DeclarativeBase - DIA-55287 (#92)
1 parent 5810159 commit cca6a72

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Fastapi-SQLA
22

33
[![codecov](https://codecov.io/gh/dialoguemd/fastapi-sqla/branch/master/graph/badge.svg?token=BQHLryClIn)](https://codecov.io/gh/dialoguemd/fastapi-sqla)
4-
[![CircleCI](https://circleci.com/gh/dialoguemd/fastapi-sqla.svg?style=svg&circle-token=998482f269270ee521aa54f2accbee2e22943743)](https://circleci.com/gh/dialoguemd/fastapi-sqla)
4+
[![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)
55
![PyPI](https://img.shields.io/pypi/v/fastapi-sqla)
66
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-brightgreen.svg)](https://conventionalcommits.org)
77
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

fastapi_sqla/sqla.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
from fastapi_sqla import aws_aurora_support, aws_rds_iam_support
2424

2525
try:
26-
from sqlalchemy.orm import declarative_base
26+
from sqlalchemy.orm import DeclarativeBase
2727
except ImportError:
2828
from sqlalchemy.ext.declarative import declarative_base
2929

30+
DeclarativeBase = declarative_base() # type: ignore
31+
3032

3133
logger = structlog.get_logger(__name__)
3234

@@ -67,7 +69,7 @@ def startup():
6769
logger.info("startup", engine=engine)
6870

6971

70-
class Base(declarative_base(cls=DeferredReflection)): # type: ignore
72+
class Base(DeclarativeBase, DeferredReflection):
7173
__abstract__ = True
7274

7375

0 commit comments

Comments
 (0)