A Ruby client library for Rockset.
gem install rockset
# Include library
require "rockset"
# Authorize instance
Rockset.auth(api_key="TOKEN HERE", server="api.rs2.usw2.rockset.com")
# To test everything is working, get your organization info
puts Rockset.get_org
Description: Make an SQL query
Parameters:
- query: The query to be performed, required, string
Example: Rockset.query("select * from commons.famous_ppl where _id='94'")
Description: Validate an SQL query
Parameters:
- query: The query to be validated, requrired, string
Example: Rockset.validate_query("select * from commons.famous_ppl where _id='94'")
Description: Add documents to a collection
Parameters:
- docs: The documents to be added, required, list containing hashes
- collection: The collection to be added documents to, requrired, string
- workspace: The workspace that holds the collection to be modified, optional, defaults to "commons", string
Example: Rockset.add_docs([{name: "John Cena", _id:"94"}], collection="famous_ppl")
Description: Delete documents
Parameters:
- docs: The documents to be deleted, required, list containing hashes
- collection: The collection of documents to be removed, required, string
- workspace: The workspace that holds the collection to be modified, optional, defaults to "commons", string
Example: Rockset.del_docs([{_id:"94"}], collection="famous_ppl")
Description: Patch documents
Parameters:
- docs: The documents to be patched, required, list containing hashes, hashes must have key
op
for patch operation,path
for field path, andvalue
. - collection: The collection of documents to be patched, required, string
- workspace: The workspace that holds the collection to be modified, optional, defaults to "commons", string
Example: Rockset.patch_docs([{op: "add", path: "occupation", value: "wrestler"}])
Description: Add a collection
Parameters:
- collection_metadata: Metadata for collection to be added, must have key
name
, can havedescription
,sources
,retention_secs
,event_time_info
,field_mappings
(Check Rockset Docs for more info) - workspace: The workspace that holds the collection to be added, optional, defaults to "commons", string
Example: Rockset.add_collection({name: "famous_ppl"})
Description: Delete a collection
Parameters:
- collection: The collection to be deleted, required, string
- workspace: The workspace that holds the collection to be deleted, optional, defaults to "commons", string
Example: Rockset.del_collection("famous_ppl")
Description: Get collection info
Parameters:
- collection: The collection to be got, required, string
- workspace: The workspace that holds the collection to be got, optional, defaults to "commons", string
Example: Rockset.get_collection("famous_ppl")
Description: Get collection query lambdas
Parameters:
- collection: The collection with the query lambdas to be got, required, string
- workspace: The workspace that holds the collection with the query lambdas, optional, defaults to "commons", string
Example: Rockset.get_collection_qlambdas("famous_ppl")
Description: Get info on all collections
Example: Rockset.get_collections
Description: Get collection query lambdas
Parameters:
- collection: The collection with the query lambdas to be got, required, string
- workspace: The workspace that holds the collection with the query lambdas, optional, defaults to "commons", string
Example: Rockset.get_workspace_collections("famous_ppl_projects")
Description: Get organization
Example: Rockset.get_org
Description: Add a query lambda
Parameters:
- name: The name of the query lambda, required, string
- query: The query of the query lambda, required, string
- description: The description of the query lambda, optional, string
- default_params: The default parameters of the query lambda, optional, list of hashes with keys
name
,type
,value
\ - workspace: The workspace that holds the query lambda, optional, defaults to "commons", string
Example: Rockset.add_qlambda("john_cena_search", query="select * from commons.famous_ppl where name='John Cena'")
Description: Delete a query lambda
Parameters:
- qlambda: The name of the query lamda to be removed, string, required
- workspace: The workspace that holds the query lambda, optional, defaults to "commons", string
Example: Rockset.del_qlambda("john_cena_search")
Description: Execute a query lambda
Parameters:
- qlambda: The name of the query lambda to be executed, required, string
- version: The version of the query lambda to be executed, required, string
- parameters: The parameters of the query lambda, optional, list
- workspace: The workspace that holds the query lambda, optional, defaults to "commons", string
Example: Rockset.exec_qlambda("john_cena_search", version="24cw39j")
get_qlamda
function- support data source integrations
- support aliases
- more query lambda options