gooddata 2.1.15 → 2.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5adf023e855cd9eb5261ed7e6cc143b77bca3536fee24aeedd4aa603aa5793d
4
- data.tar.gz: efe55e9bd06d497eb9af4be968c95201170583a419841719676f8dca51fdbd6c
3
+ metadata.gz: f14e76f590c86838c60c538ccd73ba636da3ab812658e76211a148f2e195b4da
4
+ data.tar.gz: 2261df5e9488e38560209c2a8df0048f5aad04d3451ba6b637146eb3a3118704
5
5
  SHA512:
6
- metadata.gz: 29a7eeaf7c2c1241d959ce06c716a7f1a106bcb7f65d80a282497655b4be6b630511eaee6f965da37ed4be46a37fa69083c1c53e3f3eb78390f7096b60bbb368
7
- data.tar.gz: eeb950d63670b976c20a812524dab7e65aaa6a7c4dc30f639a8f0a819cd9dd43e1d7b087171da2c0d4418b7d25fc76c80b669e172a8c2dc6aa932c3a8c8c2427
6
+ metadata.gz: cfdfca51d63852aec59a46ce18f5e746018106f69847bf31cf7b8f845d41ef88d85c9c585af2010164116aab7fc1aa4d5b3ad75199b6c56fe9107d5ed353dcaa
7
+ data.tar.gz: 97916ca5253a378319414a9fe7f4a5d673f08168085e629ff2462df6a3f0b173f62501529eb965c69d6e361333467e7340842fa217c08075950c34b8f9f2e05e
data/.sonar.settings ADDED
@@ -0,0 +1,4 @@
1
+ # Config scan necessary files/folder only
2
+ sonar.sources=bin,lib
3
+ sonar.tests=spec
4
+ sonar.exclusions=**/lib/templates/project/*.erb
data/.travis.yml CHANGED
@@ -233,15 +233,15 @@ jobs:
233
233
  - &cleanup
234
234
  stage: after-merge
235
235
  name: staging1 - test environment clean-up
236
- script: bundle exec ruby bin/test_projects_cleanup.rb -f
236
+ script: travis_wait 30 bundle exec ruby bin/test_projects_cleanup.rb -f
237
237
  env: GD_ENV=staging
238
238
 
239
239
  - <<: *cleanup
240
- name: staging2 - test environment clean-up
240
+ name: travis_wait 30 staging2 - test environment clean-up
241
241
  env: GD_ENV=testing
242
242
 
243
243
  - <<: *cleanup
244
- name: staging3 - test environment clean-up
244
+ name: travis_wait 30 staging3 - test environment clean-up
245
245
  env: GD_ENV=development
246
246
 
247
247
  # AFTER MERGE UNIT TESTS ON ALTERNATIVE PLATFORM
@@ -279,6 +279,7 @@ jobs:
279
279
  script: bundle exec rake test:unit
280
280
  os: osx
281
281
  rvm: jruby-9.1.14
282
+ osx_image: xcode7.3
282
283
 
283
284
  - stage: gem-release
284
285
  name: deploy MRI gem
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 2.1.17
3
+ - BUGFIX:TMA-1704 - Enhance error message when not found clientId in source table
4
+ - BUGFIX: TMA-1694 [UsersBrick] Enhance messages add more log for missing users when running remove_from_organization
5
+ - FEATURE:TMA-1717 - replace Erbis by standard ERB
6
+ - BUGFIX: MSF-20222 Fixing issue using find function of Enumerator
7
+ - LR-428: Update the license file for Gooddata-ruby
8
+ - BUGFIX: TMA-1714 Fixed test failed due to deleting master project and increase timeout
9
+
2
10
  ## 2.1.15
3
11
  - FEATURE: BCO-1119 Introduce data sources API
4
12
  - Upgrade active_support to be able used with Rails 6.1
data/Dockerfile CHANGED
@@ -64,6 +64,10 @@ RUN cp -rf ci/snowflake/target/*.jar ./lib/gooddata/cloud_resources/snowflake/dr
64
64
  RUN mvn -f ci/bigquery/pom.xml clean install -P binary-packaging
65
65
  RUN cp -rf ci/bigquery/target/*.jar ./lib/gooddata/cloud_resources/bigquery/drivers/
66
66
 
67
+ #build postgresql dependencies
68
+ RUN mvn -f ci/postgresql/pom.xml clean install -P binary-packaging
69
+ RUN cp -rf ci/postgresql/target/*.jar ./lib/gooddata/cloud_resources/postgresql/drivers/
70
+
67
71
  RUN bundle install
68
72
 
69
73
  ARG GIT_COMMIT=unspecified
data/LICENSE CHANGED
@@ -1,22 +1,30 @@
1
- (BSD License)
2
-
3
- Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without modification, are permitted provided
6
- that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright notice, this list of conditions and
9
- the following disclaimer.
10
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11
- and the following disclaimer in the documentation and/or other materials provided with the distribution.
12
- * Neither the name of the GoodData Corporation nor the names of its contributors may be used to endorse
13
- or promote products derived from this software without specific prior written permission.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
16
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ GOODDATA LCM END USER LICENSE AGREEMENT
2
+
3
+ GoodData Corporation ("GoodData") provides this "LCM", hereafter referred to as the "Software", to you subject to the following terms and conditions. By using the Software you agree to the terms and conditions of this Agreement. If you do not agree with any of the following terms, then do not use the Software.
4
+
5
+ 1. Use Rights. Subject to the restrictions below, you may download and modify the Software contents for your use solely for the purpose of creating applications related to Your use of the GoodData subscription services platform (“Application(s)”). Open source software components provided with or used by the Software are licensed to you under the terms of the applicable license agreements included with such open source software components, which accompany this Software.
6
+
7
+ 2. No Duty to Support; Reservation of Rights. You expressly acknowledge that GoodData has no duty or obligation to support the Software, or to provide updates or bug fixes to the Software and that GoodData otherwise reserves all rights not expressly granted to you hereunder in connection with Software.
8
+
9
+ 3. Restrictions You agree that you will not (i) use the Software to create, design or develop any functionality other than as set forth above in Section 1; (ii) allow third parties other than those performing work solely on your behalf within the scope of the license herein to modify, create derivative works of, reverse engineer, reverse compile, or disassemble the Software; (iii) distribute, sell, lease, rent, lend, or sublicense any part of the Software to any third party except as incorporated into your Application; or (iv) upload or otherwise transmit any material containing software viruses or other computer code, files or programs designed to interrupt, destroy, or limit the functionality of any software or hardware.
10
+
11
+ The restrictions in this Section 3 shall not apply if and to the extent they contradict mandatory local law (including, but not limited to, law implementing the EC Software Directive) provided that, before you exercise any rights that you believe to be entitled to based on mandatory law, you provide GoodData with 30 days prior written notice and provide all reasonably requested information to allow GoodData to assess your claim and, at GoodData's sole discretion, to provide alternatives that reduce any adverse impact on GoodData's intellectual property or other rights.
12
+
13
+ 4. GoodData Ownership. Except for those portions licensed to GoodData by third parties, GoodData retains ownership of the Software, including without limitation all copyrights and other intellectual property rights therein. You may not remove, delete or modify any of the GoodData copyright statements in the Software.
14
+
15
+
16
+ 5. Trademarks. Your use of GoodData product names and trademarks shall comply with the branding guidelines that may be distributed by GoodData from time to time. You may not use GoodData product names and trademarks, however, except where GoodData provides you express, prior written permission to use such product names and trademarks. All other marks are the property of third parties subject to applicable use terms such entities may provide.
17
+ 6. Term, Termination, and Changes. This Agreement shall continue as long as you are in compliance with the terms specified herein or until otherwise terminated. You and or GoodData each may terminate this Agreement for any reason at any time. This Agreement shall automatically terminate upon the expiration or termination of the agreement that governs your use of the GoodData subscription services. You agree, upon termination, to destroy all copies of the Software within your possession or control. The Limitations of Warranties, Liability and Indemnification sections set out in this Agreement shall survive any termination or expiration of this Agreement.
18
+
19
+ 7. Limitations of Warranties and Liability
20
+ THE SOFTWARE AND ITS SOURCE CODE IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, GOODDATA DISCLAIMS ANY IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS. YOU MAY BE ABLE TO EXERCISE ADDITIONAL WARRANTY RIGHTS OFFERED BY THIRD PARTY COMMERCIAL SOFTWARE VENDORS WHOSE COMPONENTS ARE USED BY THE SOFTWARE. IN THOSE INSTANCES, YOUR SOLE REMEDY AND RECOURSE SHALL BE AGAINST THE LICENSORS OF SUCH COMMERCIAL SOFTWARE, AND NOT AGAINST GOODDATA.
21
+
22
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL GOODDATA BE LIABLE FOR ANY LOST PROFITS OR BUSINESS OPPORTUNITIES, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, OR ANY OTHER INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR FROM THE SOFTWARE OR YOUR USE OF THE SOFTWARE, UNDER ANY THEORY OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, PRODUCT LIABILITY, OR OTHERWISE. BECAUSE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE PRECEDING LIMITATION MAY NOT APPLY TO YOU. GOODDATA'S LIABILITY ARISING OUT OF THE SOFTWARE PROVIDED HEREUNDER WILL NOT, IN ANY EVENT, EXCEED US$100.00.
23
+
24
+ THE FOREGOING LIMITATIONS SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, REGARDLESS OF WHETHER GOODDATA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF WHETHER ANY REMEDY FAILS OF ITS ESSENTIAL PURPOSE.
25
+
26
+ 8. Export Control. The Software is provided subject to the U.S. Export Administration Regulations and the regulations of other jurisdictions (e.g., the European Union). Diversion contrary to applicable law is prohibited. Without limiting the foregoing, you agree that (i) you are not acting on behalf of any person who is a citizen, national, or resident of, or who is controlled by the government of any country to which the United States or other applicable government body has prohibited export transactions (e.g., Iran, North Korea, etc.); (ii) you are not acting on behalf of, any person or entity listed on a relevant list of persons to whom export is prohibited (e.g., the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, the U.S. Commerce Department Denied Persons List or Entity List, etc.); and (iii) you will not use the Software for any purpose prohibited by applicable law.
27
+
28
+ 9. Indemnification You agree to defend, indemnify and hold harmless GoodData, and any of its directors, officers, employees, affiliates, subsidiaries or agents, from and against any and all claims, losses, damages, liabilities and other expenses (including reasonable attorneys' fees), arising from or related to: i) your use of the Software; ii) any derivative works you create using Software source code, and iii) your breach of this Agreement.
29
+
30
+ 10. Governing Law These terms are governed by the laws of the State of California and the United States of America without regard to conflict of laws principles. You may not assign any part of this Agreement without the prior written consent of GoodData. Any attempted assignment without consent shall be void. These terms constitute the entire agreement between you and GoodData with respect to the Software and supersede all prior written or oral communications, understandings and agreements. Any waiver of these terms must be in writing to be effective. If any provision of these terms is found to be invalid or unenforceable, the remaining terms will continue to be valid and enforceable to the fullest extent permitted by law.
data/LICENSE.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2021 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
data/README.md CHANGED
@@ -95,4 +95,5 @@ For full contributor info see [contributors page](https://github.com/gooddata/go
95
95
 
96
96
  ## Copyright
97
97
 
98
- Copyright (c) 2010 - 2018 GoodData Corporation and Thomas Watson Steen. See [LICENSE](/LICENSE) for details.
98
+ (c) 2010-2021 GoodData Corporation
99
+ This repository is governed by the terms and conditions in the LICENSE. This repository contains a number of open source packages detailed in NOTICES, including the GoodData Ruby SDK, which is licensed under the BSD-3-Clause license and contains additional open source components detailed in the file called LICENSE_FOR_RUBY_SDK_COMPONENT.
data/Rakefile CHANGED
@@ -33,7 +33,14 @@ namespace :gem do
33
33
  desc "Release gem version #{GoodData::VERSION} to rubygems"
34
34
  task :release do
35
35
  gem = "gooddata-#{GoodData::VERSION}.gem"
36
-
36
+ origin_license_file = 'LICENSE'
37
+ new_license_file = 'LICENSE_FOR_RUBY_SDK_COMPONENT.txt'
38
+ notices_file = 'NOTICES.txt'
39
+ File.delete(origin_license_file) if File.exist?(origin_license_file)
40
+ File.delete(notices_file) if File.exist?(notices_file)
41
+ puts "Deleted files: #{origin_license_file} and #{notices_file}"
42
+ File.rename(new_license_file, origin_license_file) if File.exists?(new_license_file)
43
+ puts "Renamed file #{new_license_file} to #{origin_license_file}"
37
44
  puts "Building #{gem} ..."
38
45
  res = `gem build ./gooddata.gemspec`
39
46
  file = res.match('File: (.*)')[1]
data/SDK_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.15
1
+ 2.1.17
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.24
1
+ 3.7.25
@@ -1,6 +1,6 @@
1
1
  require 'optparse'
2
2
 
3
- example = 'Usage example: GD_ENV=testing GD_SPEC_PASSWORD=secret bundle exec ruby bin/test_projects_cleanup.rb'
3
+ example = 'Usage example: GD_ENV=testing GD_SPEC_PASSWORD= bundle exec ruby bin/test_projects_cleanup.rb'
4
4
 
5
5
  options = {}
6
6
  OptionParser.new do |opts|
@@ -0,0 +1,57 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+
7
+ <groupId>com.gooddata.lcm</groupId>
8
+ <artifactId>lcm-postgresql-driver</artifactId>
9
+ <version>1.0-SNAPSHOT</version>
10
+
11
+ <dependencies>
12
+ <dependency>
13
+ <groupId>org.postgresql</groupId>
14
+ <artifactId>postgresql</artifactId>
15
+ <version>42.2.19</version>
16
+ </dependency>
17
+ <dependency>
18
+ <groupId>org.slf4j</groupId>
19
+ <artifactId>slf4j-api</artifactId>
20
+ <version>1.7.2</version>
21
+ </dependency>
22
+ </dependencies>
23
+
24
+ <profiles>
25
+ <profile>
26
+ <id>binary-packaging</id>
27
+ <build>
28
+ <plugins>
29
+ <plugin>
30
+ <artifactId>maven-dependency-plugin</artifactId>
31
+ <executions>
32
+ <execution>
33
+ <phase>package</phase>
34
+ <goals>
35
+ <goal>copy-dependencies</goal>
36
+ </goals>
37
+ <configuration>
38
+ <outputDirectory>${project.build.directory}</outputDirectory>
39
+ <!-- compile scope gives runtime and compile dependencies (skips test deps) -->
40
+ <includeScope>runtime</includeScope>
41
+ </configuration>
42
+ </execution>
43
+ </executions>
44
+ </plugin>
45
+ </plugins>
46
+ </build>
47
+ </profile>
48
+ </profiles>
49
+
50
+ <repositories>
51
+ <repository>
52
+ <id>my-repo1</id>
53
+ <name>my custom repo</name>
54
+ <url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
55
+ </repository>
56
+ </repositories>
57
+ </project>
data/gooddata.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'gooddata/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'gooddata'
7
7
  s.version = GoodData::VERSION
8
- s.licenses = ['BSD']
8
+ s.licenses = ['BSD-3-Clause']
9
9
  s.platform = 'java' if RUBY_PLATFORM =~ /java/
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.email = 'lcm@gooddata.com'
25
25
  s.extra_rdoc_files = %w(LICENSE README.md)
26
26
 
27
- s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
27
+ s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).map { |f| f unless %w(NOTICES.txt LICENSE_FOR_RUBY_SDK_COMPONENT.txt).include?(f) }
28
28
  s.files.reject! { |fn| fn.start_with? 'spec/' }
29
29
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
30
30
 
@@ -62,7 +62,6 @@ Gem::Specification.new do |s|
62
62
 
63
63
  s.add_dependency 'aws-sdk-s3', '~> 1.16'
64
64
  s.add_dependency 'docile', '~> 1.1'
65
- s.add_dependency 'erubis', '~> 2.7'
66
65
  s.add_dependency 'gli', '~> 2.15'
67
66
  s.add_dependency 'gooddata_datawarehouse', '~> 0.0.10' if RUBY_PLATFORM == 'java'
68
67
  s.add_dependency 'highline', '= 2.0.0.pre.develop.14'
@@ -11,7 +11,15 @@ module GoodData
11
11
  module CloudResources
12
12
  class CloudResourceFactory
13
13
  class << self
14
+ def load_cloud_resource(type)
15
+ base = "#{Pathname(__FILE__).dirname.expand_path}#{File::SEPARATOR}#{type}#{File::SEPARATOR}"
16
+ Dir.glob(base + '**/*.rb').each do |file|
17
+ require file
18
+ end
19
+ end
20
+
14
21
  def create(type, data = {}, opts = {})
22
+ load_cloud_resource(type)
15
23
  clients = CloudResourceClient.descendants.select { |c| c.respond_to?("accept?") && c.send("accept?", type) }
16
24
  raise "DataSource does not support type \"#{type}\"" if clients.empty?
17
25
 
@@ -7,6 +7,6 @@
7
7
  require 'pathname'
8
8
 
9
9
  base = Pathname(__FILE__).dirname.expand_path
10
- Dir.glob(base + '**/*.rb').each do |file|
10
+ Dir.glob(base + '*.rb').each do |file|
11
11
  require file
12
12
  end
@@ -0,0 +1,107 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+ #
4
+ # Copyright (c) 2021 GoodData Corporation. All rights reserved.
5
+ # This source code is licensed under the BSD-style license found in the
6
+ # LICENSE file in the root directory of this source tree.
7
+
8
+ require 'securerandom'
9
+ require 'java'
10
+ require 'pathname'
11
+ require_relative '../cloud_resource_client'
12
+
13
+ base = Pathname(__FILE__).dirname.expand_path
14
+ Dir.glob(base + 'drivers/*.jar').each do |file|
15
+ require file unless file.start_with?('lcm-postgresql-driver')
16
+ end
17
+
18
+ module GoodData
19
+ module CloudResources
20
+ class PostgresClient < CloudResourceClient
21
+ JDBC_POSTGRES_PATTERN = %r{jdbc:postgresql:\/\/([^:^\/]+)(:([0-9]+))?(\/)?}
22
+ POSTGRES_DEFAULT_PORT = 5432
23
+ JDBC_POSTGRES_PROTOCOL = 'jdbc:postgresql://'
24
+ SSL_JAVA_FACTORY = '&sslfactory=org.postgresql.ssl.DefaultJavaSSLFactory'
25
+ VERIFY_FULL = 'verify-full'
26
+ PREFER = 'prefer'
27
+ REQUIRE = 'require'
28
+ POSTGRES_SET_SCHEMA_COMMAND = "set search_path to"
29
+ POSTGRES_FETCH_SIZE = 1000
30
+
31
+ class << self
32
+ def accept?(type)
33
+ type == 'postgresql'
34
+ end
35
+ end
36
+
37
+ def initialize(options = {})
38
+ raise("Data Source needs a client to Postgres to be able to query the storage but 'postgresql_client' is empty.") unless options['postgresql_client']
39
+
40
+ if options['postgresql_client']['connection'].is_a?(Hash)
41
+ @database = options['postgresql_client']['connection']['database']
42
+ @schema = options['postgresql_client']['connection']['schema'] || 'public'
43
+ @authentication = options['postgresql_client']['connection']['authentication']
44
+ @ssl_mode = options['postgresql_client']['connection']['sslMode']
45
+ raise "SSL Mode should be prefer, require and verify-full" unless @ssl_mode == 'prefer' || @ssl_mode == 'require' || @ssl_mode == 'verify-full'
46
+
47
+ @url = build_url(options['postgresql_client']['connection']['url'])
48
+ else
49
+ raise('Missing connection info for Postgres client')
50
+ end
51
+
52
+ Java.org.postgresql.Driver
53
+ end
54
+
55
+ def realize_query(query, _params)
56
+ GoodData.gd_logger.info("Realize SQL query: type=postgresql status=started")
57
+
58
+ connect
59
+ filename = "#{SecureRandom.urlsafe_base64(6)}_#{Time.now.to_i}.csv"
60
+ measure = Benchmark.measure do
61
+ statement = @connection.create_statement
62
+ statement.set_fetch_size(POSTGRES_FETCH_SIZE)
63
+ has_result = statement.execute(query)
64
+ if has_result
65
+ result = statement.get_result_set
66
+ metadata = result.get_meta_data
67
+ col_count = metadata.column_count
68
+ CSV.open(filename, 'wb') do |csv|
69
+ csv << Array(1..col_count).map { |i| metadata.get_column_name(i) } # build the header
70
+ csv << Array(1..col_count).map { |i| result.get_string(i)&.to_s } while result.next
71
+ end
72
+ end
73
+ end
74
+ GoodData.gd_logger.info("Realize SQL query: type=postgresql status=finished duration=#{measure.real}")
75
+ filename
76
+ ensure
77
+ @connection&.close
78
+ @connection = nil
79
+ end
80
+
81
+ def connect
82
+ GoodData.logger.info "Setting up connection to Postgresql #{@url}"
83
+
84
+ prop = java.util.Properties.new
85
+ prop.setProperty('user', @authentication['basic']['userName'])
86
+ prop.setProperty('password', @authentication['basic']['password'])
87
+ prop.setProperty('schema', @schema)
88
+
89
+ @connection = java.sql.DriverManager.getConnection(@url, prop)
90
+ statement = @connection.create_statement
91
+ statement.execute("#{POSTGRES_SET_SCHEMA_COMMAND} #{@schema}")
92
+ @connection.set_auto_commit(false)
93
+ end
94
+
95
+ def build_url(url)
96
+ matches = url.scan(JDBC_POSTGRES_PATTERN)
97
+ raise 'Cannot reach the url' unless matches
98
+
99
+ host = matches[0][0]
100
+ port = matches[0][2]&.to_i || POSTGRES_DEFAULT_PORT
101
+ raise "Custom port #{port} is not supported. Remove it or use the default port '5432'" if POSTGRES_DEFAULT_PORT != port
102
+
103
+ "#{JDBC_POSTGRES_PROTOCOL}#{host}:#{port}/#{@database}?sslmode=#{@ssl_mode}#{VERIFY_FULL == @ssl_mode ? SSL_JAVA_FACTORY : ''}"
104
+ end
105
+ end
106
+ end
107
+ end
@@ -4,7 +4,7 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
- require 'erubis'
7
+ require 'erb'
8
8
  require 'fileutils'
9
9
  require 'pathname'
10
10
 
@@ -18,15 +18,14 @@ module GoodData
18
18
  # TODO: Add option for custom output dir
19
19
  def project(name)
20
20
  fail ArgumentError, 'No name specified' if name.nil?
21
-
22
21
  FileUtils.mkdir(name)
23
22
  FileUtils.cd(name) do
24
23
  FileUtils.mkdir('model')
25
24
  FileUtils.cd('model') do
26
25
  input = File.read(TEMPLATES_PATH + 'project/model/model.rb.erb')
27
- eruby = Erubis::Eruby.new(input)
26
+ erb = ERB.new(input)
28
27
  File.open('model.rb', 'w') do |f|
29
- f.write(eruby.result(:name => name))
28
+ f.write(erb.result_with_hash(:name => name))
30
29
  end
31
30
  end
32
31
 
@@ -36,9 +35,9 @@ module GoodData
36
35
  end
37
36
 
38
37
  input = File.read(TEMPLATES_PATH + 'project/Goodfile.erb')
39
- eruby = Erubis::Eruby.new(input)
38
+ erb = ERB.new(input)
40
39
  File.open('Goodfile', 'w') do |f|
41
- f.write(eruby.result)
40
+ f.write(erb.result)
42
41
  end
43
42
  end
44
43
  end
@@ -51,15 +50,15 @@ module GoodData
51
50
  FileUtils.mkdir(name)
52
51
  FileUtils.cd(name) do
53
52
  input = File.read(TEMPLATES_PATH + 'bricks/brick.rb.erb')
54
- eruby = Erubis::Eruby.new(input)
53
+ erb = ERB.new(input)
55
54
  File.open('brick.rb', 'w') do |f|
56
- f.write(eruby.result)
55
+ f.write(erb.result)
57
56
  end
58
57
 
59
58
  input = File.read(TEMPLATES_PATH + 'bricks/main.rb.erb')
60
- eruby = Erubis::Eruby.new(input)
59
+ erb = ERB.new(input)
61
60
  File.open('main.rb', 'w') do |f|
62
- f.write(eruby.result)
61
+ f.write(erb.result)
63
62
  end
64
63
  end
65
64
  end