trino-client 1.0.2 → 2.0.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
  SHA256:
3
- metadata.gz: fd6f8fe49771f84393aac9d14d2184c25c65915e8e219682c222d686f229a40c
4
- data.tar.gz: 3b17b2ff6dfb6d9e20f9e730fa2c51127a39c0455ffef7f239c13fb1c0e75f62
3
+ metadata.gz: 75f357cf3802250a811cc36eb0a90df8285b3af65628b9f565925717e93eacc0
4
+ data.tar.gz: 0a2ef69d01c1de0a89ce43a3484e327f79d9c1c7ea25505256966e0e92898937
5
5
  SHA512:
6
- metadata.gz: 53f7ebdcb51e1d90a4006ca29847827f213fc714bc4561d4cf992ca3296122dc0aa625c7301a597999ac91be6cb9de54192b6c13524650baece9da416dba4160
7
- data.tar.gz: 9cf5f0e74f443aee676e63deac7cb41fedf68cadfa2415d7babfc948b237327c566958a4e560d12bdb705efbafda4614c3f237883c27097e1db92f871c551399
6
+ metadata.gz: 8ed54c1d18de055e1e5ad13f56c43e43281c3d461528715f3d1714e6be36c0f515eea276dd4a828291df3e683f4795b92ecb9ff020449b55a09518ccc47e1218
7
+ data.tar.gz: 8da515df1401c00c1bedf58548a30f9eec14ead897c564dab3200f6a57f08883e5a5d94f1a4864fb93a17ddbef868eea56703cf1c86b4ccd3ca5c749d718f1c4
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @treasure-data/mpp
1
+ * @treasure-data/query
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,45 @@
1
+ name-template: 'v$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+ categories:
4
+ - title: '🚀 Features'
5
+ labels:
6
+ - 'feature'
7
+ - 'enhancement'
8
+ - title: '🐛 Bug Fixes'
9
+ labels:
10
+ - 'bug'
11
+ - title: '👋 Deprecated'
12
+ labels:
13
+ - 'deprecation'
14
+ - title: '⛓ Dependency Updates'
15
+ label:
16
+ - 'library-update'
17
+ - 'test-library-update'
18
+ - 'dependencies'
19
+ - title: '🛠 Internal Updates'
20
+ label:
21
+ - 'internal'
22
+ - 'kaizen'
23
+ - 'chore'
24
+ - title: '📚 Docs'
25
+ labels:
26
+ - 'doc'
27
+ change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
28
+
29
+ template: |
30
+ ## What's Changed
31
+ $CHANGES
32
+ **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
33
+
34
+ autolabeler:
35
+ - label: 'doc'
36
+ files:
37
+ - '*.md'
38
+ - '*.yml'
39
+ - '*.yaml'
40
+ - label: 'bug'
41
+ title:
42
+ - '/fix/i'
43
+ - label: 'deprecation'
44
+ title:
45
+ - '/deprecate/i'
@@ -0,0 +1,71 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [master]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [master]
20
+ schedule:
21
+ - cron: "15 3 * * 1"
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: ["ruby"]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56
+ # If this step fails, then you should remove it and run the build manually (see below)
57
+ - name: Autobuild
58
+ uses: github/codeql-action/autobuild@v2
59
+
60
+ # ℹ️ Command-line programs to run using the OS shell.
61
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62
+
63
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
64
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65
+
66
+ # - run: |
67
+ # echo "Run, Build Application using script"
68
+ # ./location_of_script_within_repo/buildscript.sh
69
+
70
+ - name: Perform CodeQL Analysis
71
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Release Drafter
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ push:
7
+ branches:
8
+ - master
9
+ pull_request:
10
+ # Only following types are handled by the action, but one can default to all as well
11
+ types: [opened, reopened, synchronize]
12
+ # pull_request_target event is required for auto-labeler to support PRs from forks
13
+ pull_request_target:
14
+ types: [opened, reopened, synchronize]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ update_release_draft:
21
+ permissions:
22
+ contents: write
23
+ pull-requests: write
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ # Drafts your next Release notes as Pull Requests are merged into "master"
27
+ - uses: release-drafter/release-drafter@v5
28
+ env:
29
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # This workflow uses actions that are not certified by GitHub.
2
3
  # They are provided by a third-party and are governed by
3
4
  # separate terms of service, privacy policy, and support
@@ -7,24 +8,32 @@
7
8
 
8
9
  name: Ruby
9
10
 
10
- on: [push, pull_request]
11
+ on:
12
+ push:
13
+ branches:
14
+ - main
15
+ - master
16
+ pull_request:
11
17
 
12
18
  jobs:
13
19
  test:
14
20
  runs-on: ubuntu-latest
15
21
  strategy:
22
+ fail-fast: false
16
23
  matrix:
17
- ruby-version: ['2.5', '2.6', '2.7']
18
-
24
+ ruby-version: ['2.7', '3.0', '3.2']
25
+ faraday-version: ['~> 1', '~> 2']
26
+ env:
27
+ FARADAY_VERSION: ${{ matrix.faraday-version }}
28
+ timeout-minutes: 5 # Typically ends within 1-2 min
19
29
  steps:
20
- - uses: actions/checkout@v2
21
- - name: Set up Ruby
22
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
23
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
24
- # uses: ruby/setup-ruby@v1
25
- uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
26
- with:
27
- ruby-version: ${{ matrix.ruby-version }}
28
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
29
- - name: Run tests
30
- run: bundle exec rake spec
30
+ - uses: actions/checkout@v3
31
+ - name: Set up Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby-version }}
35
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
36
+ - name: Check coding style
37
+ run: bundle exec standardrb
38
+ - name: Run tests
39
+ run: bundle exec rake spec
data/.standard.yml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ fix: false
3
+ format: progress # default: Standard::Formatter
4
+ default_ignores: false # default: true
5
+
6
+ ignore:
7
+ - 'vendor/bundle/**/*'
8
+ - lib/trino/client/model_versions/0.149.rb
9
+ - lib/trino/client/model_versions/0.153.rb
10
+ - lib/trino/client/model_versions/0.173.rb
11
+ - lib/trino/client/model_versions/0.178.rb
12
+ - lib/trino/client/model_versions/0.205.rb
13
+ - lib/trino/client/model_versions/303.rb
14
+ - lib/trino/client/model_versions/316.rb
15
+ - lib/trino/client/model_versions/351.rb
@@ -0,0 +1,80 @@
1
+ ---
2
+ ignore:
3
+ - 'lib/trino/client/*.rb':
4
+ - Layout/EmptyLinesAroundModuleBody
5
+ - Layout/FirstHashElementIndentation
6
+ - Layout/SpaceAroundEqualsInParameterDefault
7
+ - Layout/SpaceInsideBlockBraces
8
+ - Layout/SpaceInsideBlockBraces
9
+ - Lint/AssignmentInCondition
10
+ - Lint/UselessAssignment
11
+ - Naming/VariableName
12
+ - Performance/RegexpMatch
13
+ - Performance/StringReplacement
14
+ - Style/ConditionalAssignment
15
+ - Style/HashConversion
16
+ - Style/HashSyntax
17
+ - Style/NilComparison
18
+ - Style/RedundantBegin
19
+ - Style/RedundantFileExtensionInRequire
20
+ - Style/RedundantInterpolation
21
+ - Style/RedundantReturn
22
+ - Style/RedundantSelf
23
+ - Style/SafeNavigation
24
+ - Style/Semicolon
25
+ - Style/StringLiterals
26
+ - Style/StringLiteralsInInterpolation
27
+ - Style/TernaryParentheses
28
+ - Style/TrailingCommaInHashLiteral
29
+
30
+ - 'modelgen/model_versions.rb': &modelgen_common
31
+ - Style/StringLiterals # TODO: Remove this later
32
+ - Layout/DotPosition # TODO: Remove this later
33
+ # NOTE: Selecting the below items
34
+ - Layout/ArrayAlignment
35
+ - Layout/EmptyLinesAroundExceptionHandlingKeywords
36
+ - Layout/FirstArrayElementIndentation
37
+ - Layout/FirstHashElementIndentation
38
+ - Lint/AssignmentInCondition
39
+ - Lint/Syntax
40
+ - Lint/UselessAssignment
41
+ - Performance/FlatMap
42
+ - Performance/RegexpMatch
43
+ - Style/InfiniteLoop
44
+ - Style/RedundantRegexpCharacterClass
45
+ - Style/RedundantRegexpEscape
46
+ - Style/StringLiteralsInInterpolation
47
+ - 'modelgen/modelgen.rb': *modelgen_common
48
+ - 'modelgen/models.rb': *modelgen_common
49
+ - 'modelgen/trino_models.rb': *modelgen_common
50
+ - 'spec/*.rb':
51
+ - Style/StringLiterals # TODO: Remove this later
52
+ - Layout/DotPosition # TODO: Remove this later
53
+ - Style/RedundantBegin
54
+ - Style/TrailingCommaInHashLiteral
55
+ - Lint/Void
56
+ - Layout/FirstHashElementIndentation
57
+ - Style/For
58
+ - Style/Semicolon
59
+ - Lint/UselessAssignment
60
+ - Style/MixinUsage
61
+ # NOTE: Selecting the below items
62
+ - Layout/ClosingParenthesisIndentation
63
+ - Layout/HashAlignment
64
+ - Layout/IndentationConsistency
65
+ - Layout/MultilineMethodCallBraceLayout
66
+ - Layout/MultilineMethodCallIndentation
67
+ - Lint/ElseLayout
68
+ - Lint/ParenthesesAsGroupedExpression
69
+ - Style/HashSyntax
70
+ - Style/IfWithSemicolon
71
+ - Style/MethodCallWithoutArgsParentheses
72
+ - Style/OneLineConditional
73
+ - Style/RescueStandardError
74
+ - Style/StderrPuts
75
+ - '**/*.gemspec':
76
+ - Layout/ExtraSpacing
77
+ - 'release.rb':
78
+ - Style/TrailingCommaInArguments
79
+ - Style/SlicingWithRange
80
+ - Style/GlobalStdStream
data/ChangeLog.md CHANGED
@@ -1,5 +1,44 @@
1
1
  trino-client-ruby
2
2
  ====
3
+ ## 2.0.0
4
+ - Bump actions/checkout from 2 to 3 ([#99](https://github.com/treasure-data/trino-client-ruby/issues/99)) [[3022dc1](https://github.com/treasure-data/trino-client-ruby/commit/3022dc1)]
5
+ - linter: Enable linter on lib ([#98](https://github.com/treasure-data/trino-client-ruby/issues/98)) [[1c043cd](https://github.com/treasure-data/trino-client-ruby/commit/1c043cd)]
6
+ - ci: fix typo ([#97](https://github.com/treasure-data/trino-client-ruby/issues/97)) [[69d966d](https://github.com/treasure-data/trino-client-ruby/commit/69d966d)]
7
+ - Faraday 2.x and 1.x cross support ([#94](https://github.com/treasure-data/trino-client-ruby/issues/94)) [[401639e](https://github.com/treasure-data/trino-client-ruby/commit/401639e)]
8
+ - "push" event on pull requests are redundant ([#95](https://github.com/treasure-data/trino-client-ruby/issues/95)) [[f935407](https://github.com/treasure-data/trino-client-ruby/commit/f935407)]
9
+ - Fix for Ruby 3.2.x ([#92](https://github.com/treasure-data/trino-client-ruby/issues/92)) [[3e8fad5](https://github.com/treasure-data/trino-client-ruby/commit/3e8fad5)]
10
+ - Update CODEOWNERS [[4d8709a](https://github.com/treasure-data/trino-client-ruby/commit/4d8709a)]
11
+ - Merge pull request [#90](https://github.com/treasure-data/trino-client-ruby/issues/90) from treasure-data/release-drafter [[390a745](https://github.com/treasure-data/trino-client-ruby/commit/390a745)]
12
+ - Merge pull request [#80](https://github.com/treasure-data/trino-client-ruby/issues/80) from treasure-data/dependabot/bundler/rspec-tw-3.12.0 [[b525d85](https://github.com/treasure-data/trino-client-ruby/commit/b525d85)]
13
+ - Migrate legacy "should" to "expect" [[9c22bb0](https://github.com/treasure-data/trino-client-ruby/commit/9c22bb0)]
14
+ - Bump rake so it works with rspec 3.x [[7354526](https://github.com/treasure-data/trino-client-ruby/commit/7354526)]
15
+ - Update rspec requirement from ~> 2.13.0 to ~> 3.12.0 [[0c82814](https://github.com/treasure-data/trino-client-ruby/commit/0c82814)]
16
+ - Merge pull request [#91](https://github.com/treasure-data/trino-client-ruby/issues/91) from treasure-data/dependabot/bundler/standard-tw-1.24.3 [[ec7a559](https://github.com/treasure-data/trino-client-ruby/commit/ec7a559)]
17
+ - Remove the deprecated "test_files" to make the gem package smaller [[7e03774](https://github.com/treasure-data/trino-client-ruby/commit/7e03774)]
18
+ - Use parentheses with complex conditions [[c6351b7](https://github.com/treasure-data/trino-client-ruby/commit/c6351b7)]
19
+ - Remove redundant escape [[b52d244](https://github.com/treasure-data/trino-client-ruby/commit/b52d244)]
20
+ - Update standard requirement from ~> 1.12.1 to ~> 1.24.3 [[0723dc7](https://github.com/treasure-data/trino-client-ruby/commit/0723dc7)]
21
+ - Introduce release-drafter github action [[7cf538b](https://github.com/treasure-data/trino-client-ruby/commit/7cf538b)]
22
+ - Run unit tests in github actions with ruby 3 ([#89](https://github.com/treasure-data/trino-client-ruby/issues/89)) [[58e899d](https://github.com/treasure-data/trino-client-ruby/commit/58e899d)]
23
+ - Upgrade minimum ruby version to 2.7 ([#86](https://github.com/treasure-data/trino-client-ruby/issues/86)) [[07921fd](https://github.com/treasure-data/trino-client-ruby/commit/07921fd)]
24
+ - Bump ruby/setup-ruby from 1.61.0 to 1.133.2 ([#85](https://github.com/treasure-data/trino-client-ruby/issues/85)) [[79e722c](https://github.com/treasure-data/trino-client-ruby/commit/79e722c)]
25
+ - Update dependabot.yaml [[96cf01d](https://github.com/treasure-data/trino-client-ruby/commit/96cf01d)]
26
+ - Update addressable requirement from ~> 2.4.0 to ~> 2.8.1 ([#82](https://github.com/treasure-data/trino-client-ruby/issues/82)) [[24b0c9e](https://github.com/treasure-data/trino-client-ruby/commit/24b0c9e)]
27
+ - Update simplecov requirement from ~> 0.10.0 to ~> 0.22.0 ([#83](https://github.com/treasure-data/trino-client-ruby/issues/83)) [[8e46420](https://github.com/treasure-data/trino-client-ruby/commit/8e46420)]
28
+ - Merge pull request [#79](https://github.com/treasure-data/trino-client-ruby/issues/79) from treasure-data/dependabot/bundler/standard-tw-1.12.1 [[d82433f](https://github.com/treasure-data/trino-client-ruby/commit/d82433f)]
29
+ - Reformat [[8fb2672](https://github.com/treasure-data/trino-client-ruby/commit/8fb2672)]
30
+ - Update standard requirement from ~> 1.0.0 to ~> 1.12.1 [[bbb900f](https://github.com/treasure-data/trino-client-ruby/commit/bbb900f)]
31
+ - Create dependabot.yaml [[d1b619a](https://github.com/treasure-data/trino-client-ruby/commit/d1b619a)]
32
+ - Merge pull request [#78](https://github.com/treasure-data/trino-client-ruby/issues/78) from treasure-data/standardrb [[bed70c9](https://github.com/treasure-data/trino-client-ruby/commit/bed70c9)]
33
+ - Reformat Rakefile and etc [[6e08989](https://github.com/treasure-data/trino-client-ruby/commit/6e08989)]
34
+ - Introduce standard [[009173e](https://github.com/treasure-data/trino-client-ruby/commit/009173e)]
35
+ - Merge pull request [#76](https://github.com/treasure-data/trino-client-ruby/issues/76) from treasure-data/SECU-1152 [[5c9b488](https://github.com/treasure-data/trino-client-ruby/commit/5c9b488)]
36
+ - Remove ruby 2.5 from testing targets [[cdaa0e4](https://github.com/treasure-data/trino-client-ruby/commit/cdaa0e4)]
37
+ - Create codeql-analysis.yml [[116a17f](https://github.com/treasure-data/trino-client-ruby/commit/116a17f)]
38
+ - Merge pull request [#77](https://github.com/treasure-data/trino-client-ruby/issues/77) from treasure-data/retry-interval [[cfd99f6](https://github.com/treasure-data/trino-client-ruby/commit/cfd99f6)]
39
+ - Update retryable errors [[e8878f6](https://github.com/treasure-data/trino-client-ruby/commit/e8878f6)]
40
+ - Minor change for retry logic for testing [[190fd92](https://github.com/treasure-data/trino-client-ruby/commit/190fd92)]
41
+
3
42
  ## 1.0.2
4
43
  - Merge pull request [#75](https://github.com/treasure-data/trino-client-ruby/issues/75) from evgeniy-b/1-0-1-fixes [[4cdd21f](https://github.com/treasure-data/trino-client-ruby/commit/4cdd21f)]
5
44
  - Faraday basic auth deprecation fix [[5c20266](https://github.com/treasure-data/trino-client-ruby/commit/5c20266)]
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
- source 'https://rubygems.org/'
1
+ source "https://rubygems.org/"
2
2
  gemspec
3
3
 
4
4
  group :development, :test do
5
- gem 'tiny-presto', "~> 0.0.8"
5
+ gem "tiny-presto", "~> 0.0.10"
6
+ gem "faraday", ENV.fetch("FARADAY_VERSION", "~> 2")
6
7
  end
data/Rakefile CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
2
+ require "bundler/gem_tasks"
3
3
 
4
- require 'rake/testtask'
5
- require 'rake/clean'
4
+ require "rake/testtask"
5
+ require "rake/clean"
6
6
 
7
- require 'rspec/core/rake_task'
7
+ require "rspec/core/rake_task"
8
8
 
9
9
  RSpec::Core::RakeTask.new(:spec)
10
10
 
11
- task :default => [:spec, :build]
11
+ task default: [:spec, :build]
12
12
 
13
13
  GEN_MODEL_VERSIONS = %w[
14
14
  351
15
15
  ]
16
16
 
17
17
  namespace "modelgen" do
18
- task :latest => :all do
19
- require 'erb'
18
+ task latest: :all do
19
+ require "erb"
20
20
  erb = ERB.new(File.read("modelgen/models.rb"))
21
21
  @versions = GEN_MODEL_VERSIONS
22
22
  @latest_version = GEN_MODEL_VERSIONS.last
@@ -24,7 +24,7 @@ namespace "modelgen" do
24
24
  File.write("lib/trino/client/models.rb", data)
25
25
  end
26
26
 
27
- task :all => GEN_MODEL_VERSIONS
27
+ task all: GEN_MODEL_VERSIONS
28
28
 
29
29
  GEN_MODEL_VERSIONS.each do |ver|
30
30
  file "build/trino-#{ver}.tar.gz" do
@@ -42,4 +42,3 @@ namespace "modelgen" do
42
42
  task ver => "lib/trino/client/model_versions/#{ver}.rb"
43
43
  end
44
44
  end
45
-
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Trino::Client
17
+ FARADAY1_USED = Faraday::VERSION.start_with?("1.")
18
+ private_constant :FARADAY1_USED
17
19
 
18
20
  require 'cgi'
19
21
 
@@ -70,18 +72,24 @@ module Trino::Client
70
72
  url = "#{ssl ? "https" : "http"}://#{server}"
71
73
  proxy = options[:http_proxy] || options[:proxy] # :proxy is obsoleted
72
74
 
73
- faraday_options = {url: url, proxy: "#{proxy}"}
75
+ faraday_options = {url: url}
76
+ faraday_options[:proxy] = "#{proxy}" if proxy
74
77
  faraday_options[:ssl] = ssl if ssl
75
78
 
76
79
  faraday = Faraday.new(faraday_options) do |faraday|
77
80
  if options[:user] && options[:password]
78
- faraday.request(:basic_auth, options[:user], options[:password])
81
+ # https://lostisland.github.io/faraday/middleware/authentication
82
+ if FARADAY1_USED
83
+ faraday.request(:basic_auth, options[:user], options[:password])
84
+ else
85
+ faraday.request :authorization, :basic, options[:user], options[:password]
86
+ end
79
87
  end
80
88
  if options[:follow_redirect]
81
- faraday.use FaradayMiddleware::FollowRedirects
89
+ faraday.response :follow_redirects
82
90
  end
83
91
  if options[:gzip]
84
- faraday.use FaradayMiddleware::Gzip
92
+ faraday.request :gzip
85
93
  end
86
94
  faraday.response :logger if options[:http_debug]
87
95
  faraday.adapter Faraday.default_adapter
@@ -16,7 +16,8 @@
16
16
  module Trino::Client
17
17
 
18
18
  require 'faraday'
19
- require 'faraday_middleware'
19
+ require 'faraday/gzip'
20
+ require 'faraday/follow_redirects'
20
21
  require 'trino/client/models'
21
22
  require 'trino/client/errors'
22
23
  require 'trino/client/faraday_client'
@@ -106,11 +107,12 @@ module Trino::Client
106
107
  raise TrinoError, "Query #{@api.current_results.id} has no columns"
107
108
  end
108
109
 
109
- begin
110
+ loop do
110
111
  if data = @api.current_results.data
111
112
  block.call(data)
112
113
  end
113
- end while advance_and_raise
114
+ break unless advance_and_raise
115
+ end
114
116
  end
115
117
 
116
118
  def query_info
@@ -193,7 +193,7 @@ module Trino::Client
193
193
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
194
194
  attempts = 0
195
195
 
196
- begin
196
+ loop do
197
197
  begin
198
198
  response = @faraday.get(uri)
199
199
  rescue Faraday::TimeoutError, Faraday::ConnectionFailed
@@ -218,7 +218,9 @@ module Trino::Client
218
218
 
219
219
  attempts += 1
220
220
  sleep attempts * 0.1
221
- end while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) < @retry_timeout && !client_aborted?
221
+
222
+ break unless (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) < @retry_timeout && !client_aborted?
223
+ end
222
224
 
223
225
  exception! TrinoHttpError.new(408, "Trino API error due to timeout")
224
226
  end
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Trino
17
17
  module Client
18
- VERSION = "1.0.2"
18
+ VERSION = "2.0.0"
19
19
  end
20
20
  end
data/lib/trino/client.rb CHANGED
@@ -15,9 +15,7 @@
15
15
  #
16
16
  module Trino
17
17
  module Client
18
-
19
- require 'trino/client/version'
20
- require 'trino/client/client'
21
-
18
+ require "trino/client/version"
19
+ require "trino/client/client"
22
20
  end
23
21
  end
data/lib/trino-client.rb CHANGED
@@ -1 +1 @@
1
- require 'trino/client'
1
+ require "trino/client"
data/modelgen/modelgen.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  if ARGV.length != 4
3
2
  puts "usage: <model-version> <trino-source-dir> <template.erb> <output.rb>"
4
3
  exit 1
@@ -70,7 +69,7 @@ name_mapping = Hash[*%w[
70
69
  StatementStats StageStats ClientStageStats
71
70
  ClientStageStats StageStats ClientStageStats
72
71
  QueryResults Column ClientColumn
73
- ].each_slice(3).map { |x, y, z| [[x,y], z] }.flatten(1)]
72
+ ].each_slice(3).map { |x, y, z| [[x, y], z] }.flatten(1)]
74
73
 
75
74
  path_mapping = Hash[*%w[
76
75
  ClientColumn client/trino-client/src/main/java/io/trino/client/Column.java
@@ -82,7 +81,7 @@ PartitionedOutputInfo core/trino-main/src/main/java/io/trino/operator/Partitione
82
81
  TableWriterInfo core/trino-main/src/main/java/io/trino/operator/TableWriterOperator.java
83
82
  TableInfo core/trino-main/src/main/java/io/trino/execution/TableInfo.java
84
83
  DynamicFiltersStats core/trino-main/src/main/java/io/trino/server/DynamicFilterService.java
85
- ].map.with_index { |v,i| i % 2 == 0 ? v : (source_path + "/" + v) }]
84
+ ].map.with_index { |v, i| (i % 2 == 0) ? v : (source_path + "/" + v) }]
86
85
 
87
86
  # model => [ [key,nullable,type], ... ]
88
87
  extra_fields = {
@@ -107,7 +106,7 @@ formatter = TrinoModels::ModelFormatter.new(
107
106
  primitive_types: assume_primitive,
108
107
  skip_types: skipped_models,
109
108
  simple_classes: predefined_simple_classes,
110
- enum_types: enum_types,
109
+ enum_types: enum_types
111
110
  )
112
111
  formatter.format(models)
113
112
 
@@ -116,4 +115,3 @@ formatter.format(models)
116
115
 
117
116
  data = erb.result
118
117
  File.write(output_path, data)
119
-