小编Goo*_*are的帖子

SQLAlchemy ORM 检查列是否为foreign_key

您好,我想知道是否有人知道找出列是否具有外键关系的最有效方法。

class StudentIntendCourse(DeclarativeBase):
    __tablename__ = 'studentIntendCourse'
    id = Column(Integer, primary_key=True)
    studentID = Column('studentID',Integer,ForeignKey('student.id'))
    courseID = Column('courseID',Integer,ForeignKey('course.id'))
    course = relationship("Course",backref="studentIntendedCourses")
Run Code Online (Sandbox Code Playgroud)

我想知道是否 is_foreign_key(StudentIntendCourse.studentID)?

python sqlalchemy

7
推荐指数
1
解决办法
5822
查看次数

标签 统计

python ×1

sqlalchemy ×1