gooddata-bricks 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac70370e48daace3df8c5ad82328118ceae8c67
|
4
|
+
data.tar.gz: b0b7f0a86b6b8fa2aa1ddc239d853e70209c7cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0462a2f3999a9d4f184c93664516710cb96b4af5be6b25d97a624c5ea1e1c267ec70e198200060e4b3e82d81d02cd22a044285c703653a501e6f68e24cc7be7
|
7
|
+
data.tar.gz: 19d62829588c08d11db351165ba973f54a7b81947deddeac3356aacbaba2f04ce162908bdef113a4177d1b5dd444c231d8c707abd28a942d623f614935fac298
|
data/.rubocop.yml
CHANGED
@@ -16,6 +16,7 @@ module GoodData
|
|
16
16
|
protocol_name = 'CLIENT_GDC_PROTOCOL'
|
17
17
|
server_name = 'CLIENT_GDC_HOSTNAME'
|
18
18
|
project_id = params['GDC_PROJECT_ID']
|
19
|
+
verify_ssl = params['GDC_VERIFY_SSL'] == 'false' || params['GDC_VERIFY_SSL'] == false ? false : true
|
19
20
|
|
20
21
|
server = if params[protocol_name] && params[server_name]
|
21
22
|
"#{params[protocol_name]}://#{params[server_name]}"
|
@@ -24,10 +25,10 @@ module GoodData
|
|
24
25
|
client = if params['GDC_USERNAME'].nil? || params['GDC_PASSWORD'].nil?
|
25
26
|
puts "Connecting with SST to server #{server}"
|
26
27
|
raise 'SST (SuperSecureToken) not present in params' if params[token_name].nil?
|
27
|
-
GoodData.connect(sst_token: params[token_name], server: server)
|
28
|
+
GoodData.connect(sst_token: params[token_name], server: server, verify_ssl: verify_ssl)
|
28
29
|
else
|
29
30
|
puts "Connecting as #{params['GDC_USERNAME']} to server #{server}"
|
30
|
-
GoodData.connect(params['GDC_USERNAME'], params['GDC_PASSWORD'], server: server)
|
31
|
+
GoodData.connect(params['GDC_USERNAME'], params['GDC_PASSWORD'], server: server, verify_ssl: verify_ssl)
|
31
32
|
end
|
32
33
|
project = client.projects(project_id)
|
33
34
|
GoodData.project = project
|
@@ -13,6 +13,17 @@ module GoodData
|
|
13
13
|
class DataSource
|
14
14
|
attr_reader :realized
|
15
15
|
|
16
|
+
class << self
|
17
|
+
def interpolate_sql_params(query, params)
|
18
|
+
keys = query.scan(/\$\{([^\{]+)\}/).flatten
|
19
|
+
keys.reduce(query) do |a, e|
|
20
|
+
key = e
|
21
|
+
raise "Param #{key} is not present in schedule params yet it is expected to be interpolated in the query" unless params.key?(key)
|
22
|
+
a.gsub("${#{key}}", params[key])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
16
27
|
def initialize(opts = {})
|
17
28
|
opts = opts.is_a?(String) ? { type: :staging, path: opts } : opts
|
18
29
|
opts = GoodData::Helpers.symbolize_keys(opts)
|
@@ -45,7 +56,7 @@ module GoodData
|
|
45
56
|
private
|
46
57
|
|
47
58
|
def realize_query(params)
|
48
|
-
query = @options[:query]
|
59
|
+
query = DataSource.interpolate_sql_params(@options[:query], params)
|
49
60
|
dwh = params['ads_client']
|
50
61
|
raise "Data Source needs a client to ads to be able to query the storage but 'ads_client' is empty." unless dwh
|
51
62
|
filename = Digest::SHA256.new.hexdigest(query)
|
@@ -53,7 +64,6 @@ module GoodData
|
|
53
64
|
CSV.open(filename, 'w') do |csv|
|
54
65
|
header_written = false
|
55
66
|
header = nil
|
56
|
-
|
57
67
|
dwh.execute_select(query) do |row|
|
58
68
|
unless header_written
|
59
69
|
header_written = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gooddata-bricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Svarovsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|