Message Boards Message Boards

1 Reply
5 Total Likes
View groups...
Share this post:

Querying Databins like Datasets ?

Posted 9 years ago

Would there be a way to query Databins like Datasets ? As the underlying data of Databins should be in general Associations as said in the documentation, if we could query Databins like Datasets Databins could be used as small scale databases, similarly to MongoDB for example (a queryable key value document store).

My need stems from if I would like to store similar data that belongs to different groups, and I would like to only download the latest data belonging to a specific group. I could create many databins, but it would be more practical in my use case to have only one such place.

POSTED BY: Faysal Aberkane

There are ways to do what you like. However, because of the way data is stored at the DataDrop, the speed of the query doesn't really increase if you select a single "group" as opposed to the whole group.

The simplest example is to just wrap Dataset around a Databin. You can specify the date range here, which definitely will speed up the download time. Of course, this will download all of the keys used in the bin. The following evaluation took about 2 seconds for my bin.

Dataset[Databin[binid, {DateObject["Feb 2"], DateObject["Feb 14"]}]]

If you only want to get a single key (or list of keys), you can try something like this:

Dataset[Databin[binid, {DateObject["Feb 2"], DateObject["Feb 14"]}]["Data"]["MyKey"]]

However, this takes the same amount of time as the previous evaluation on my machine (your results my vary!). Also, in this case, you won't necessarily need to wrap the databin with Dataset. This will depend on what you want to do with the data.

POSTED BY: Chad Knutson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract