-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UniqueConstraint not enforced in CompartmentalizedComponent #9
Comments
My pleasure ! I'm sorry, I did not know about this get_or_create function, thanks for showing it to me ! Pierre EDIT: UniqueConstraint('compartment_id', 'component_id') should be replaced by: __table_args__ = (
UniqueConstraint('compartment_id', 'component_id'),
{}) EDIT2: This goes also for the classes: Model
ModelReaction
ReactionMatrix in models.py that have the same problem |
Ok, I'm looking into it. It's strange that the unique constraint is not On Mon, Nov 3, 2014 at 11:32 AM, Pierre SALVY notifications@github.com
|
Also, in the declaration of the Model class, as follows: class Model(Base):
__tablename__='model'
id = Column(Integer, Sequence('wids'), primary_key=True)
bigg_id = Column(String)
first_created = Column(DateTime)
genome_id = Column(Integer, ForeignKey('genome.id'))
genome = relationship('Genome', backref='model')
UniqueConstraint('name', 'firstcreated')
notes = Column(String)
__table_args__ = (UniqueConstraint('bigg_id'),{})
def __repr__(self):
return "Model (#%d) %s %s" % (self.id, self.bigg_id, self.first_created) I noticed a double declaration of the UniqueConstraint, one of which is invalid according to what I posted above, and I also noticed that they do not ask for the same uniqueness. |
@jslu9 Is this still happening? |
Hi again,
I came across an issue while uploading several times my model, at which point I discovered that the UniqueConstraint of the rows in the table CompartmentalizedComponent are not enforced, despite its declaration:
And I also discovered that the upload method for compartmentalized components in model_loading.py:
does not check for prior existence of the said compartmentalized component, unlike how it's done with the metabolites. What happens next in loadModelCompartmentalizedComponent when calling
is that the component is linked to one among many identical compartmentalized components (first() call). This gets worse when you run a query like
to get the list of compartmentalized components used in your model, and try to fetch from it an id equal to a ReactionMatrix.compartmentalized_component_id. It does not work because this last one points to another sibling of this compartmentalized component which likely not the one in your model.
I don't know if this was very clear, but to sum up there are two points:
A simple fix for this one would be:
I attached a printscreen as an illustration.
The text was updated successfully, but these errors were encountered: