Skip to content

Commit

Permalink
index on table_args rather than uniqueconstraint
Browse files Browse the repository at this point in the history
  • Loading branch information
for-hyde committed Nov 7, 2024
1 parent a43c325 commit de3699d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions omnipath_metabo/schema/_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Numeric,
Index,
UniqueConstraint,
func
)
from sqlalchemy.orm import relationship
from ._base import Base
Expand All @@ -26,19 +27,15 @@ class Structure(Base):
id = Column(Integer, primary_key = True)
name = Column(String)
smiles = Column(String)
inchi = Column(String(4096), unique = True)
inchi = Column(String(4096), unique= True)
mol = Column(MolType)
identifier = relationship(
'Identifier',
backref='structure',
foreign_keys='Identifier.structure_id'
)
__table_args__ = (
UniqueConstraint(
'inchi',
name = 'uq_inchi',
postgresql_using = 'hash' # Specify the index type here
),
Index('inchi_large_index', func.md5(inchi), unique=True ),
)


Expand Down

0 comments on commit de3699d

Please sign in to comment.