-
Notifications
You must be signed in to change notification settings - Fork 80
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
Study and StudyPerson object #70
Changes from 70 commits
b926cf3
406e5c1
5acb8c1
e1f0d27
6f857b9
1443068
62bfcd8
bea579c
34b5a96
04acc84
d53b091
8507bb1
cbf8509
207bd93
cb606d5
84163ef
bc18758
b0ef52e
f2f805d
caa68ac
a0b3b09
ae7707f
1df40c5
741de07
89a7275
0f0edb2
ee9b677
d128aa1
4b92c89
7748910
69ff05e
67acbdc
843c458
6d144b4
61ed70b
7f8bfb3
ac49f38
db5eaff
17e8220
3c24b1d
10c4c04
b061b2e
51da641
0d755d0
7bfa663
e506ccf
0e691b4
678df7a
352dbda
e29947c
e41bc7c
136007d
f5c333e
69af985
b99c43b
95c4629
ea5973a
5a09f9e
5f86893
fadcaa7
28eea2f
ddb9972
3a1df46
6503a78
2332ba1
9007a91
18c2edf
c4a2234
e03e612
e06472b
4d74534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,18 @@ class QiitaDBConnectionError(QiitaDBError): | |
pass | ||
|
||
|
||
class QiitaDBColumnError(QiitaDBError): | ||
"""Exception when missing table information or excess information passed""" | ||
pass | ||
|
||
|
||
class QiitaDBDuplicateError(QiitaDBError): | ||
"""Exception when duplicating something in the database""" | ||
pass | ||
|
||
|
||
class QiitaDBColumnError(QiitaDBError): | ||
"""Exception when database column info missing or incorrect""" | ||
class QiitaDBStatusError(QiitaDBError): | ||
"""Exception when editing is done with an unallowed status""" | ||
pass | ||
|
||
|
||
|
@@ -45,4 +50,4 @@ class QiitaDBUnknownIDError(QiitaDBError): | |
def __init__(self, missing_id, table): | ||
super(QiitaDBUnknownIDError, self).__init__() | ||
self.args = ("The object with ID '%s' does not exists in table '%s" | ||
% (missing_id, table)) | ||
% (missing_id, table),) | ||
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. I don't think this comma is needed, right? 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. It's needed to turn the args into a tuple so they can be processed correctly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,18 @@ class MetadataTemplate(QiitaStatusObject): | |
# instantiate this base class | ||
_table_prefix = None | ||
_column_table = None | ||
_id_column = None | ||
|
||
def _check_id(self, id_, conn_handler=None): | ||
# PLACEHOLDER SO TESTS PASS. Jose will rewrite for metadata pr | ||
r"""""" | ||
self._check_subclass() | ||
conn_handler = (conn_handler if conn_handler is not None | ||
else SQLConnectionHandler()) | ||
return conn_handler.execute_fetchone( | ||
"SELECT EXISTS(SELECT * FROM qiita.{0} WHERE " | ||
"{1}=%s)".format(self._table, self._id_column), | ||
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. Neat! never knew you could combine the 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. Yeah, it's really handy for SQL like this. |
||
(id_, ))[0] | ||
|
||
@classmethod | ||
def _get_table_name(cls, study_id): | ||
|
@@ -262,8 +274,10 @@ def has_single_category_values(self, category): | |
|
||
class SampleTemplate(MetadataTemplate): | ||
"""""" | ||
_table = "required_sample_info" | ||
_table_prefix = "sample_" | ||
_column_table = "study_sample_columns" | ||
_id_column = "study_id" | ||
|
||
|
||
class PrepTemplate(MetadataTemplate): | ||
|
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.
This is strange, conn_handler is a parameter but the first thing it does is conn_handler = SQLConnectionHandler()