Commit e70eb488 authored by Martino Bertoni's avatar Martino Bertoni 🌋

fixing db relationships

parent 9d618cee
......@@ -208,8 +208,9 @@ class Dataset(Base): # NS Base is a base class from SQLAlchemy, no __init__??
# derived = Column(Boolean) # implemented as property
datasources = relationship("Datasource",
secondary="dataset_has_datasource",
lazy='joined')
secondary="dataset_has_datasource",
back_populates="datasets",
lazy='joined')
def __repr__(self):
"""String representation."""
......
......@@ -45,11 +45,12 @@ class Datasource(Base):
datasets = relationship("Dataset",
secondary="dataset_has_datasource",
overlaps="datasources",
back_populates="datasources",
lazy='joined')
molrepos = relationship("Molrepo",
secondary="molrepo_has_datasource",
back_populates="datasources",
lazy='joined')
def __repr__(self):
......
......@@ -50,6 +50,11 @@ class Molrepo(Base):
universe = Column(Boolean)
essential = Column(Boolean)
datasources = relationship("Datasource",
secondary="molrepo_has_datasource",
back_populates="molrepos",
lazy='joined')
def __repr__(self):
"""String representation."""
return str(self.molrepo_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment