sbg / sevenbridges-python

SevenBridges Python Api bindings
Apache License 2.0
46 stars 27 forks source link

Query on integer metadata does not work as expected #34

Closed ghost closed 8 years ago

ghost commented 8 years ago
import os
import sevenbridges as sbg

api = sbg.Api(url=os.environ['SBG_API_URL'], token=os.environ['SBG_AUTH_TOKEN'])

project_id = 'bug'
billing_group_id = 'd8473d69-b921-4e79-88c7-92a149ef6f4a' # id for SBG BiX R&D - General Development
dummy_file_id = '578cf948507c17681a3117d9'  # Small, publicly accessible file

project = api.projects.create(name=project_id, billing_group=billing_group_id)
f = api.files.get(id=dummy_file_id)
new_f = f.copy(project=project, name='test-file.txt')

new_f.metadata = {'str': 'my unique signature'}
new_f.save()

fc = api.files.query(project=project, metadata={'str': 'my unique signature'})
print(len(fc))  # -> 1  As expected.

new_f.metadata.update({'int': 77})
new_f.save()

fc = api.files.query(project=project, metadata={'str': 'my unique signature'})
print(len(fc))  # -> 1  As expected.

fc = api.files.query(project=project, metadata={'int': 77})
print(len(fc))  # -> 0  Unexpected!

fc = api.files.query(project=project, metadata={'str': 'my unique signature', 'int': 77})
print(len(fc))  # -> 0  Unexpected!
SenadI commented 8 years ago

@kghosesbg I know about this issue and it is a server issue now a library one. Closing.