mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 19:04:18 +00:00
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
from sqlalchemy.ext.automap import automap_base
|
|
from sqlalchemy.orm import relationship
|
|
from . import engine
|
|
|
|
|
|
Base = automap_base()
|
|
|
|
|
|
# Classes for database models
|
|
class Corpus(Base):
|
|
__tablename__ = 'corpora'
|
|
files = relationship('CorpusFile', collection_class=set)
|
|
|
|
|
|
class CorpusFile(Base):
|
|
__tablename__ = 'corpus_files'
|
|
|
|
|
|
class Job(Base):
|
|
__tablename__ = 'jobs'
|
|
inputs = relationship('JobInput', collection_class=set)
|
|
results = relationship('JobResult', collection_class=set)
|
|
notification_data = relationship('NotificationData', collection_class=list)
|
|
notification_email_data = relationship('NotificationEmailData',
|
|
collection_class=list)
|
|
|
|
|
|
class JobInput(Base):
|
|
__tablename__ = 'job_results'
|
|
|
|
|
|
class JobResult(Base):
|
|
__tablename__ = 'job_results'
|
|
|
|
|
|
class NotificationData(Base):
|
|
__tablename__ = 'notification_data'
|
|
job = relationship('Job', collection_class=set)
|
|
|
|
|
|
class NotificationEmailData(Base):
|
|
__tablename__ = 'notification_email_data'
|
|
job = relationship('Job', collection_class=set)
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = 'users'
|
|
jobs = relationship('Job', collection_class=set)
|
|
corpora = relationship('Corpus', collection_class=set)
|
|
|
|
|
|
Base.prepare(engine, reflect=True)
|