rocksetdb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ced5bfde58e7dbdcd9c518452deb176f2da2e275e173a06eab6e11d4d73deef9
4
+ data.tar.gz: 136896c881d00b0eea2e11c323e52be112ad4d9553a6b16b85cdeb0b38c4e78a
5
+ SHA512:
6
+ metadata.gz: efa5bbd7a9ec3219a02cc5396cf6a7c855592d800f5837e04d254d3097af35acf0a6d0297e37bd34d8b8d2a8cd102a40784718d9aad665e8c51338a378af8858
7
+ data.tar.gz: 1a6f4e8d2b3c124199aad4066ff00c6ff7ac649afdb23b7eefcf26fdb0bd9c13c241c751753fc98df3621a46b36a2c898b9b75e615304b391082901b5bfab9f0
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-11-04
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ ruby '2.5.8', :engine => 'jruby', :engine_version => '9.2.19'
6
+
7
+ # Specify your gem's dependencies in rockset.gemspec
8
+ gemspec
9
+
10
+ gem "rake", "~> 13.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rocksetdb (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ parallel (1.21.0)
11
+ parser (3.0.2.0)
12
+ ast (~> 2.4.1)
13
+ rainbow (3.0.0)
14
+ rake (13.0.6)
15
+ regexp_parser (2.1.1)
16
+ rexml (3.2.5)
17
+ rubocop (1.22.3)
18
+ parallel (~> 1.10)
19
+ parser (>= 3.0.0.0)
20
+ rainbow (>= 2.2.2, < 4.0)
21
+ regexp_parser (>= 1.8, < 3.0)
22
+ rexml
23
+ rubocop-ast (>= 1.12.0, < 2.0)
24
+ ruby-progressbar (~> 1.7)
25
+ unicode-display_width (>= 1.4.0, < 3.0)
26
+ rubocop-ast (1.12.0)
27
+ parser (>= 3.0.1.1)
28
+ ruby-progressbar (1.11.0)
29
+ unicode-display_width (2.1.0)
30
+
31
+ PLATFORMS
32
+ universal-java-1.8
33
+
34
+ DEPENDENCIES
35
+ rake (~> 13.0)
36
+ rocksetdb!
37
+ rubocop (~> 1.21)
38
+
39
+ RUBY VERSION
40
+ ruby 2.5.8p0 (jruby 9.2.19.0)
41
+
42
+ BUNDLED WITH
43
+ 2.2.30
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Vysakh Sreenivasan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Rockset DB
2
+
3
+ A ruby wrapper around RocksetDB's java client.
4
+
5
+ ### Pre-requisites:
6
+
7
+ - Install openssl, openjdk (1.8) and then install jruby 9.2.19.0
8
+ - Download the 0.9.0 rockset-db jar file
9
+ - Set `CLASSPATH` to your jar file.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'rocksetdb'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install rocksetdb
26
+
27
+ ## Usage
28
+
29
+ ```ruby
30
+ rockset = Rockset::DB.new(<your password>, <your api server>)
31
+
32
+ str = 'select * from commons.user limit 1'
33
+ results = rockset.query(str)
34
+ # you can also use sequel or some gem to construct this sql string and pass.
35
+
36
+ rockset.create_collection "mycollection", "workspace"
37
+
38
+ values = [{name: '', description: ''}]
39
+ rockset.create_document "mycollection", values
40
+
41
+ ```
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task :console do
9
+ exec 'irb -r rockset -I ./lib'
10
+ end
11
+ task default: :rubocop
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'rockset'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rockset
4
+ VERSION = '0.1.0'
5
+ end
data/lib/rockset.rb ADDED
@@ -0,0 +1,56 @@
1
+ # assumes you have the jar already loaded in the classpath
2
+
3
+ java_import 'com.rockset.client.RocksetClient'
4
+ java_import 'com.rockset.client.model.AddDocumentsRequest'
5
+ java_import 'com.rockset.client.model.CreateCollectionRequest'
6
+ java_import 'com.rockset.client.model.QueryRequest'
7
+ java_import 'com.rockset.client.model.QueryRequestSql'
8
+
9
+ require_relative 'rockset/version'
10
+
11
+ module Rockset
12
+ class DB
13
+ attr_reader :rockset_client, :model
14
+
15
+ # alias_method :insert, :create_document
16
+ # alias_method :create_table, :create_collection
17
+
18
+ def initialize(apikey, apiserver = 'api.rs2.usw2.rockset.com')
19
+ @rockset_client = RocksetClient.new apikey, apiserver
20
+ end
21
+
22
+ def query(query_str)
23
+ query_request = QueryRequest.new
24
+ query_sql = QueryRequestSql.new.query(query_str)
25
+ req = query_request.sql(query_sql)
26
+ res = rockset_obj.query req
27
+ res.get_results.to_a
28
+ end
29
+
30
+ def create_document(collection, values, workspace = 'commons')
31
+ docs = create_doc_request(values)
32
+ rockset_obj.addDocuments(workspace, collection, docs)
33
+ end
34
+
35
+ def create_collection(collection_name, workspace = 'commons')
36
+ collection = create_collection_request(collection_name)
37
+ rockset_obj.create_collection(workspace, collection)
38
+ end
39
+
40
+ private
41
+
42
+ def rockset_obj
43
+ @rockset_client ||= create_client
44
+ end
45
+
46
+ def create_doc_request(values)
47
+ add_doc_req = AddDocumentsRequest.new
48
+ add_doc_req.data(values)
49
+ end
50
+
51
+ def create_collection_request(value)
52
+ collection_req = CreateCollectionRequest.new
53
+ collection_req.name(value)
54
+ end
55
+ end
56
+ end
data/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "rocksetdb",
3
+ "private": true,
4
+ "devDependencies": {
5
+ "@prettier/plugin-ruby": "^1.6.1",
6
+ "prettier": "^2.3.2"
7
+ }
8
+ }
data/rockset.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rockset/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rocksetdb'
7
+ spec.version = Rockset::VERSION
8
+ spec.authors = ['Vysakh Sreenivasan']
9
+ spec.email = ['diplomatv@gmail.com']
10
+
11
+ spec.summary = 'A ruby wrapper for Rockset db'
12
+ spec.description = 'A ruby wrapper for Rockset db java client'
13
+ spec.homepage = 'https://github.com/databrainhq/rockset.rb'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.5.8'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = spec.homepage
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files =
24
+ Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) ||
27
+ f.match(
28
+ %r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)},
29
+ )
30
+ end
31
+ end
32
+ spec.bindir = 'exe'
33
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ['lib']
35
+
36
+ # Uncomment to register a new dependency of your gem
37
+ # spec.add_dependency "example-gem", "~> 1.0"
38
+
39
+ # For more information and examples about making a new gem, checkout our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
data/yarn.lock ADDED
@@ -0,0 +1,15 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "@prettier/plugin-ruby@^1.6.1":
6
+ version "1.6.1"
7
+ resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-1.6.1.tgz#14489985513a72e052b57c1cf9beae288880faa8"
8
+ integrity sha512-PGDCATgVTQz0s/NB9nStiXVCIr+hG/XnKeAO/kguaHrNf8VwCpP5Ul+/KQao0z0QFBy2PDY8kWptfDQCa7WMXg==
9
+ dependencies:
10
+ prettier ">=1.10"
11
+
12
+ prettier@>=1.10, prettier@^2.3.2:
13
+ version "2.4.1"
14
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
15
+ integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rocksetdb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vysakh Sreenivasan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-11-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A ruby wrapper for Rockset db java client
14
+ email:
15
+ - diplomatv@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rubocop.yml"
21
+ - CHANGELOG.md
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - bin/console
28
+ - bin/setup
29
+ - lib/rockset.rb
30
+ - lib/rockset/version.rb
31
+ - package.json
32
+ - rockset.gemspec
33
+ - yarn.lock
34
+ homepage: https://github.com/databrainhq/rockset.rb
35
+ licenses:
36
+ - MIT
37
+ metadata:
38
+ homepage_uri: https://github.com/databrainhq/rockset.rb
39
+ source_code_uri: https://github.com/databrainhq/rockset.rb
40
+ changelog_uri: https://github.com/databrainhq/rockset.rb
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 2.5.8
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.1.6
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: A ruby wrapper for Rockset db
60
+ test_files: []