Skip to content

Commit

Permalink
Create index on download/data object association
Browse files Browse the repository at this point in the history
This should speed up biosample search, since it returns download
statistics for each data object for each biosample.
  • Loading branch information
naglepuff committed Oct 10, 2024
1 parent 219f034 commit bc3b108
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Create index on column `data_object_id` for table `bulk_download_data_object`
Revision ID: 2ec2d0b4f840
Revises: 5fb9910ca8e6
Create Date: 2024-10-10 16:48:37.051479
"""

from typing import Optional

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "2ec2d0b4f840"
down_revision: Optional[str] = "5fb9910ca8e6"
branch_labels: Optional[str] = None
depends_on: Optional[str] = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(
"bulk_download_data_object_id_idx",
"bulk_download_data_object",
["data_object_id"],
unique=False,
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("bulk_download_data_object_id_idx", table_name="bulk_download_data_object")
# ### end Alembic commands ###
4 changes: 4 additions & 0 deletions nmdc_server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Enum,
Float,
ForeignKey,
Index,
Integer,
LargeBinary,
String,
Expand Down Expand Up @@ -834,6 +835,9 @@ class BulkDownloadDataObject(Base):
)


Index("bulk_download_data_object_id_idx", BulkDownloadDataObject.data_object_id)


class EnvoTree(Base):
__tablename__ = "envo_tree"

Expand Down

0 comments on commit bc3b108

Please sign in to comment.