This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Metadata server #33
Open
rsm0001
wants to merge
7
commits into
master
Choose a base branch
from
metadata_server
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Metadata server #33
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5177135
schema changes for fields
52771a3
schema changes for fields
5d4256b
schema enhanced for fields
0163a70
fixed schema for field and field_set
810b3cb
changes for field_combine_op column
cd837a4
suggestions in code review
7051916
fixing travis build
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
metadb/alembic/versions/4f93dc7aa8e8_create_field_set_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""create field_set table | ||
|
||
Revision ID: 4f93dc7aa8e8 | ||
Revises: 4631177f4ecc | ||
Create Date: 2017-05-25 11:22:32.344826 | ||
|
||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '4f93dc7aa8e8' | ||
down_revision = '4631177f4ecc' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
# making ontology terms strings for now | ||
# leaving out externalId, diseases, pheno, etc. mappings for now | ||
op.drop_table('field') | ||
op.create_table( | ||
'field_set', | ||
sa.Column('id', sa.BigInteger, primary_key=True), | ||
sa.Column('guid', sa.String(36), nullable=False, unique=True), | ||
sa.Column('description', sa.Text) | ||
) | ||
op.create_table( | ||
'field', | ||
sa.Column('id', sa.BigInteger, primary_key=True), | ||
sa.Column('guid', sa.String(36), nullable=False, unique=True), | ||
sa.Column('field', sa.String(32), nullable=False), | ||
sa.Column('field_set_id', sa.BigInteger, sa.ForeignKey('field_set.id'), nullable=False), | ||
sa.Column('type', sa.Enum('Integer', 'String', 'Float', 'Flag', name='type_enum')), | ||
sa.Column('is_filter', sa.Boolean, nullable=False), | ||
sa.Column('is_format', sa.Boolean, nullable=False), | ||
sa.Column('is_info', sa.Boolean, nullable=False), | ||
sa.Column('length_type', sa.Enum('A', 'R', 'G', 'VAR', 'NUM', name='length_enum')), | ||
sa.Column('length_intval', sa.Integer, default=0, server_default=sa.text('1')), | ||
sa.Column('field_combine_op', sa.Enum('sum', 'mean', 'median', 'move_to_FORMAT', 'element_wise_sum', 'concatenate', name='field_combine_optype')) | ||
) | ||
op.create_unique_constraint('unique_name_per_field_set_constraint', 'field', ['field_set_id', 'field']) | ||
op.add_column(u'db_array', sa.Column('field_set_id', sa.BigInteger, sa.ForeignKey('field_set.id'), nullable=False)) | ||
|
||
def downgrade(): | ||
op.drop_constraint('unique_name_per_reference_set_constraint', 'field', type_='unique') | ||
op.drop_table('field') | ||
op.drop_table('field_set') | ||
op.create_table( | ||
'field', | ||
sa.Column('id', sa.BigInteger, primary_key=True), | ||
sa.Column('field', sa.Text, nullable=False) | ||
) | ||
op.drop_column(u'db_array', 'field_set_id') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,23 @@ | |
|
||
from ..models import _Base, BigInteger | ||
import sqlalchemy as sa | ||
|
||
import enum | ||
|
||
class Field(_Base): | ||
__tablename__ = "field" | ||
id = sa.Column(BigInteger, primary_key=True) | ||
field = sa.Column(sa.Text, nullable=False) | ||
id = sa.Column(sa.BigInteger, primary_key=True) | ||
guid = sa.Column(sa.String(36), nullable=False, unique=True) | ||
field = sa.Column(sa.String(32), nullable=False) | ||
field_set_id = sa.Column(BigInteger, sa.ForeignKey('field_set.id'), nullable=False) | ||
# Unique constraint on (field_set_id, name) | ||
__table_args__ = ( | ||
sa.UniqueConstraint('field_set_id', 'field', | ||
name='unique_name_per_field_set_constraint'), | ||
) | ||
type = sa.Column(sa.Enum('Integer', 'String', 'Float', 'Flag', name='type_enum')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullable=False |
||
is_filter = sa.Column(sa.Boolean, nullable=False) | ||
is_format = sa.Column(sa.Boolean, nullable=False) | ||
is_info = sa.Column(sa.Boolean, nullable=False) | ||
length_type = sa.Column(sa.Enum('A', 'R', 'G', 'VAR', 'NUM', name='length_enum')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullable = False |
||
length_intval = sa.Column(sa.Integer, default=1, server_default=sa.text('1')) | ||
field_combine_op = sa.Column(sa.Enum('sum', 'mean', 'median', 'move_to_FORMAT', 'element_wise_sum', 'concatenate', name='field_combine_optype')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
The MIT License (MIT) | ||
Copyright (c) 2016 Intel Corporation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
""" | ||
|
||
from ..models import _Base, BigInteger | ||
import sqlalchemy as sa | ||
from sqlalchemy.orm import relationship, backref | ||
|
||
|
||
class FieldSet(_Base): | ||
__tablename__ = "field_set" | ||
id = sa.Column(BigInteger, primary_key=True) | ||
guid = sa.Column(sa.String(36), nullable=False, unique=True) | ||
description = sa.Column(sa.Text) | ||
arrays = relationship('DBArray', backref='field_set') | ||
fields = relationship('Field', backref='field_set') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ alembic==0.8.2 | |
psycopg2==2.6.1 | ||
PyVCF==0.6.8 | ||
pysam==0.9.0 | ||
sqlalchemy_schemadisplay==1.3 | ||
enum34==1.1.6 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an if statement if( reader) surrounding all the reader statements? ie. allow calling registerFieldSet with reader=None.