Last active
August 10, 2016 07:39
-
-
Save mydreambei-ai/8917851cd02d06251faa4efe8d8f5871 to your computer and use it in GitHub Desktop.
sqlalchemy declare abstract base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.ext.declarative import declared_attr, AbstractConcreteBase | |
class _Event(AbstractConcreteBase): | |
@declared_attr | |
def hackinfo_id(self): | |
return Column(ForeignKey("hackinfos.id", ondelete='CASCADE')) | |
@declared_attr | |
def hackinfo(self): | |
return relationship("HackInfo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment