In the Flask project, how to use MySQL and MongoDB, Sqlalchemy and MongoEngine at the same time?
from mongoengine import * import datetime class Page(Document): title = StringField(max_length=200, required=True) date_modified = ateTimeField(default=datetime.datetime.now) author = xxxx? ? ? ? [How does this relate to User? ? Manual? 】 ======= from sqlalchemy import Column, Integer, String class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String)
Two kinds of databases, can’t refer to each other. Let’s do it manually. Write Page a property, such as get_user or something.