Skip to content

Commit

Permalink
Merge pull request #17 from david4096/fixtupleadd
Browse files Browse the repository at this point in the history
Fixtupleadd
  • Loading branch information
david4096 authored Jul 26, 2017
2 parents 54921f7 + 5ac5dce commit 2d39c77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 6 additions & 3 deletions celldb/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ def _upsert_sample(cursor, sample_id, feature_ids, values):
"""
keys = ["expression:{}:{}".format(sample_id, f) for f in feature_ids]
# add a sample key/value pair
keys.append("sample:{}".format(sample_id))
values.append(True)
return _multi_upsert(cursor, keys, values)
sample_key = "sample:{}".format(sample_id)
key_list = list(keys)
value_list = list(values)
key_list.append(sample_key)
value_list.append(True)
return _multi_upsert(cursor, key_list, value_list)


def _upsert_features(cursor, feature_ids):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
namespace_packages=["celldb"],
zip_safe=False,
url="https://github.com/david4096/celldb",
version=2.0,
version=2.1,
entry_points={
'console_scripts': [] # TODO add one for SQL line
},
Expand Down
9 changes: 9 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def test_upsert_samples(self):
assert set(celldb.list_samples(cursor)) == set(sample_ids)
assert set(celldb.list_features(cursor)) == set(feature_ids)

def test_upsert_tuple(self):
"""
Checks to make sure that the client accepts both tuples and lists.
:return:
"""
connection = celldb.connect(URL)
celldb.upsert_samples(
connection, ('sample_tuple',), ('feature_tuple',), ((0.1,),))


class TestUpsertTimes:
"""
Expand Down

0 comments on commit 2d39c77

Please sign in to comment.