Hi Михаил,

On Mon, Feb 1, 2010 at 9:58 AM, Михаил <[email protected]> wrote:
> I have a table like
>
> class Servers(Storm):
>    __storm_table__ = 'servers'
>    id = Int(primary = True)
>    ip = Int()
>    hostname = Unicode()
>    path = Unicode()
>    comment = Unicode()
>    wait = Int()
>    disk_available = Int()
>    disk_used = Int()
>    priority = Float()
>    files = ReferenceSet(id, 'Files.server_id')
>
> How I can limit result of BoundReferenceSet object (Servers.files)? I tried
>
> s = store.get(Servers, 1)
> s.files[0:10]
>
> but got the error:
>
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: 'BoundReferenceSet' object is unsubscriptable

You can use the find method to accomplish what you want:

server = store.get(Servers, 1)
files = server.files.find()[0:10]

or, spelt a bit differently:

server = store.get(Servers, 1)
result = server.files.find()
result.config(offset=0, limit=10)
files = list(result)

Thanks,
J.

-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to