1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/examplepack/tables/example.py

22 lines
532 B
Python
Raw Normal View History

2019-11-04 11:57:35 +00:00
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declared_attr
2020-07-31 15:06:54 +00:00
# TODO: delete this file!
2019-11-04 11:57:35 +00:00
class Example:
__tablename__ = "examples"
@declared_attr
def creator_id(self):
return Column(Integer, ForeignKey("users.uid"), primary_key=True)
@declared_attr
def creator(self):
return relationship("User", backref=backref("examples_createdx"))
@declared_attr
def example(self):
return Column(String, nullable=False, default="Hello world!")