Comments (5)
Awesome!! Thanks Pierre.
Assigning @jslu9 as this could be critical for BiGG and he has the closest familiarity with that code.
@jslu9 we could probably also use this to develop a test case to make sure we don't get similar issues in other areas of the code.
Thanks Pierre!
from cobradb.
My pleasure ! I'm sorry, I did not know about this get_or_create function, thanks for showing it to me !
I'll keep you updated if I find new stuff.
Pierre
EDIT:
I think I kinow why the unique constraint is not enforced: it is not declared as a table_args, but placed 'naked' in the column declaration. As we are using the declarative mode of SQLAlchemy, the line
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
from cobradb.
Ok, I'm looking into it. It's strange that the unique constraint is not
being enforced by sqlalchemy. I'm going to put the unique constraints into
the table args and see if it configures the table correctly that way.
On Mon, Nov 3, 2014 at 11:32 AM, Pierre SALVY [email protected]
wrote:
My pleasure ! I'm sorry, I did not know about this get_or_create function,
thanks for showing it to me !
I'll keep you updated if I find new stuff.Pierre
—
Reply to this email directly or view it on GitHub
#9 (comment).
from cobradb.
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.
from cobradb.
@jslu9 Is this still happening?
from cobradb.
Related Issues (14)
- Case sensitive directory names in Ubtunu HOT 1
- SQLAlchemy 0.9.8 will throw warnings for use of 'type' column in multiple inheritance HOT 1
- Normalisation issue on ModelReaction
- Pierre Salvy, greatest coder in the world HOT 11
- Quick speedup in loading/model_loading.py
- Inconsistencies in class name resolution in model_loading.py HOT 2
- model dumper should add linkouts as annotation HOT 1
- We should use a named schema HOT 3
- All genomic locations are off by 1 in all organisms (leftpos too low) HOT 1
- metabolite_duplicates specified twice in settings.ini.example
- setup.py install_packages is broken HOT 1
- Components need to have unique ids HOT 1
- Numeric data type in SQLAlchemy HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cobradb.