Query Collection

Hey, I’m creating a collection in Python using aws s3 (using rs.Collection.create(name=collection_name, sources=[s3]

How do I query the data in the collection immediately after the collection is created?


You can only query the collection once it is marked READY.

Here’s an example snippet to check the status of your collection:

>>> from rockset import Client
>>> rs = Client()
>>> collection = rs.Collection.retrieve(name=<collection name>)
>>> collection.describe()['data']['status']

Once the collection is ready, you can query it using the Python Query Builder. For example, let’s say you want to list 10 documents from this collection. You could do:

>>> from rockset import Client, Q, F
>>> rs = Client()
>>> q = Q(<collection name>).limit(10)
>>> results = rs.sql(q).results()

I hope this helps. Please let us know if you have any other questions.