Add support for SQLAlchemy 1.4. (#1328)

This commit is contained in:
Omer Katz 2021-04-06 14:20:46 +03:00 committed by GitHub
parent 4446438767
commit 7c34684ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -4,10 +4,15 @@ import datetime
from sqlalchemy import (Column, Integer, String, Text, DateTime,
Sequence, Boolean, ForeignKey, SmallInteger, Index)
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.orm import relation
from sqlalchemy.schema import MetaData
try:
from sqlalchemy.orm import declarative_base, declared_attr
except ImportError:
# TODO: Remove this once we drop support for SQLAlchemy < 1.4.
from sqlalchemy.ext.declarative import declarative_base, declared_attr
class_registry = {}
metadata = MetaData()
ModelBase = declarative_base(metadata=metadata, class_registry=class_registry)