redshift_connector-queuery 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 44e282de30cd6a22a17e1447c57307fde96b5d602d931214b2fe4381e9bae0d2
4
+ data.tar.gz: 8942b67704a904beb98538e5b3205d44adfd7ce492d8783a4802913da8bbcd92
5
+ SHA512:
6
+ metadata.gz: 66e4a3b100707eb125833caa826dbb20c94e8489ed37782d65bf92d1110cd9543efec449e83bc9bee89e7d203967a6d9dfcafbb0ad19036b0227610b03e6f470
7
+ data.tar.gz: d24cd113783b166aaa3ac8cc68ab56f0ffdd2d11f8f29ed0950e9c1aa0af151476fcdbb214f99f412ce23ddf681e404351134397a63c0c2ac1265b0105623a77
@@ -0,0 +1 @@
1
+ /Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org/'
2
+ gemspec
3
+ gem 'activerecord', '~> 5.0'
4
+ gem 'mysql2', '< 0.5.0'
@@ -0,0 +1,21 @@
1
+ # redshift_connector adapter for Queuery
2
+
3
+ redshift_connector adapter for Queuery (Redshift HTTP API).
4
+ Queuery is Cookpad internal system, you may not need this library.
5
+
6
+ ## Setup
7
+
8
+ Add following line to your Gemfile.
9
+ ```
10
+ gem 'redshift_connector-queuery'
11
+ ```
12
+
13
+ Add `config/initializer/redshift_connector.rb` as following:
14
+ ```
15
+ QueueryClient.configure do |config|
16
+ config.endpoint = "https://queuery.example.com"
17
+ config.token = "xxxxxxxxxx"
18
+ config.token_secret = "yyyyyyyyyy"
19
+ end
20
+ RedshiftConnector::Exporter.default_data_source = RedshiftConnector::QueueryDataSource.new
21
+ ```
@@ -0,0 +1,3 @@
1
+ require 'redshift_connector/queuery_data_source'
2
+ require 'redshift_connector/queuery_direct_data_source'
3
+ require 'redshift_connector/queuery_exporter'
@@ -0,0 +1,22 @@
1
+ require 'redshift_connector/queuery_exporter'
2
+ require 'redshift_connector/exporter_builder'
3
+ require 'redshift_connector/exception'
4
+ require 'queuery_client/client'
5
+
6
+ module RedshiftConnector
7
+ class QueueryDataSource
8
+ def initialize(client = nil)
9
+ @client = client || QueueryClient::Client.new
10
+ end
11
+
12
+ def exporter_builder
13
+ ExporterBuilder.new(ds: self, exporter_class: QueueryExporter)
14
+ end
15
+
16
+ def execute_query(stmt, params = [])
17
+ @client.query(stmt, params)
18
+ rescue QueueryClient::QueryError => ex
19
+ raise ExportError, ex.message
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,10 @@
1
+ require 'redshift_connector/queuery_data_source'
2
+ require 'redshift_connector/exception'
3
+
4
+ module RedshiftConnector
5
+ class QueueryDirectDataSource < QueueryDataSource
6
+ def execute_query(stmt, params = [])
7
+ super(stmt, params).direct
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ require 'redshift_connector/logger'
2
+
3
+ module RedshiftConnector
4
+ class QueueryExporter
5
+ def initialize(ds:, query:, bundle_params: nil, enable_sort: false, logger: RedshiftConnector.logger)
6
+ @ds = ds
7
+ @query = query
8
+ @bundle_params = bundle_params
9
+ @bundle = nil
10
+ @enable_sort = enable_sort
11
+ @logger = logger
12
+ end
13
+
14
+ attr_reader :query
15
+ attr_reader :bundle_params
16
+ attr_reader :bundle
17
+ attr_reader :logger
18
+
19
+ def execute
20
+ @logger.info "EXPORT #{@query.description} -> (Queuery S3 tmp)"
21
+ stmt = @query.to_sql
22
+ @logger.info "[SQL/Queuery] #{stmt.strip}"
23
+ # FIXME: support enable_sort
24
+ # FIXME: pass bundle_params?
25
+ @bundle = @ds.execute_query(stmt)
26
+ @bundle
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.platform = Gem::Platform::RUBY
3
+ s.name = 'redshift_connector-queuery'
4
+ s.version = '10.0.0'
5
+ s.summary = 'Queuery adapter for redshift_connector'
6
+ s.license = 'MIT'
7
+
8
+ s.author = ['Minero Aoki']
9
+ s.email = ['aamine@loveruby.net']
10
+ s.homepage = 'https://github.com/bricolages/redshift_connector-queuery'
11
+
12
+ s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
13
+ s.require_path = 'lib'
14
+
15
+ s.required_ruby_version = '>= 2.1.0'
16
+ s.add_dependency 'redshift_connector', '~> 8.0'
17
+ s.add_dependency 'queuery_client', '~> 1.0'
18
+ s.add_development_dependency 'test-unit'
19
+ s.add_development_dependency 'rake'
20
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redshift_connector-queuery
3
+ version: !ruby/object:Gem::Version
4
+ version: 10.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Minero Aoki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: redshift_connector
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '8.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '8.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: queuery_client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - aamine@loveruby.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - README.md
79
+ - lib/redshift_connector-queuery.rb
80
+ - lib/redshift_connector/queuery_data_source.rb
81
+ - lib/redshift_connector/queuery_direct_data_source.rb
82
+ - lib/redshift_connector/queuery_exporter.rb
83
+ - redshift_connector-queuery.gemspec
84
+ homepage: https://github.com/bricolages/redshift_connector-queuery
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.1.0
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.7.6.2
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Queuery adapter for redshift_connector
108
+ test_files: []