sequel-snowflake 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/lib/sequel/adapters/snowflake.rb +7 -0
- data/lib/sequel-snowflake/version.rb +1 -1
- data/sequel-snowflake.gemspec +2 -2
- data/spec/sequel/adapters/snowflake_spec.rb +41 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 772b801f7ed529ccadccd14d02fad21713a6e62d1d23a6b531647a4a876d5238
|
4
|
+
data.tar.gz: 9b92e7bceb1899f346d117299e733b4773bf65b3b17140968b286ac262026a1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd4c7cdf415e197569747c1181056312b3f4389049b3de254ebd407c1e8d882e3cac9f6fe7a5351e6e1330d57abb89e2805fac4a51112049863af189660e7025
|
7
|
+
data.tar.gz: 9d21e394346317988787eadf729d14a0a7caab19fddf639b9b1c9e9227766025c246e15f55b5e44ea9f4b34cc49eac387696ca3835d327a7e69ba34f34e539fa
|
data/.github/workflows/ruby.yml
CHANGED
@@ -19,16 +19,18 @@ jobs:
|
|
19
19
|
runs-on: ubuntu-latest
|
20
20
|
strategy:
|
21
21
|
matrix:
|
22
|
-
ruby-version: ['
|
22
|
+
ruby-version: ['3.0', '3.1']
|
23
23
|
|
24
24
|
steps:
|
25
25
|
- uses: actions/checkout@v2
|
26
|
-
- name:
|
27
|
-
run: sudo apt-get
|
26
|
+
- name: Update package lists
|
27
|
+
run: sudo apt-get update
|
28
|
+
- name: Install unixodbc-dev, odbcinst, and unixodbc
|
29
|
+
run: sudo apt-get -y install unixodbc-dev odbcinst unixodbc
|
28
30
|
- name: Install Snowflake ODBC driver
|
29
31
|
run: curl ${SNOWFLAKE_DRIVER_URL} -o snowflake_driver.deb && sudo dpkg -i snowflake_driver.deb
|
30
32
|
env:
|
31
|
-
SNOWFLAKE_DRIVER_URL: https://sfc-repo.snowflakecomputing.com/odbc/linux/
|
33
|
+
SNOWFLAKE_DRIVER_URL: https://sfc-repo.snowflakecomputing.com/odbc/linux/3.1.1/snowflake-odbc-3.1.1.x86_64.deb
|
32
34
|
- name: Set up Ruby
|
33
35
|
uses: ruby/setup-ruby@v1
|
34
36
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## 2.2.0 / 2023-10-17
|
8
|
+
* Add support for `MERGE` (credit: @benalavi)
|
9
|
+
* Add requirement for `sequel` v5.58.0 or newer (to support the new MERGE methods).
|
10
|
+
|
7
11
|
## 2.1.0 / 2022-06-17
|
8
12
|
* Add support for `EXPLAIN`.
|
9
13
|
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
An adapter to connect to Snowflake databases using [Sequel](http://sequel.jeremyevans.net/).
|
4
4
|
This provides proper types for returned values, as opposed to the ODBC adapter.
|
5
5
|
|
6
|
-
[![Ruby](https://github.com/
|
6
|
+
[![Ruby](https://github.com/vendasta/sequel-snowflake/actions/workflows/ruby.yml/badge.svg)](https://github.com/vendasta/sequel-snowflake/actions/workflows/ruby.yml)
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -57,7 +57,7 @@ be taken down either via the `after(:each)` blocks or when the connection is clo
|
|
57
57
|
|
58
58
|
We have two workflows included in this project:
|
59
59
|
|
60
|
-
* Ruby (`ruby.yml`): This runs the specs for this gem against Ruby
|
60
|
+
* Ruby (`ruby.yml`): This runs the specs for this gem against Ruby 3.0 and 3.1. Note
|
61
61
|
that this requires the secret `SNOWFLAKE_CONN_STR` to be set (see above for example connection string),
|
62
62
|
as we need to connect to Snowflake to run tests. These specs will be run for every pull request,
|
63
63
|
and is run after every commit to those branches.
|
@@ -68,7 +68,7 @@ to authenticate with RubyGems.
|
|
68
68
|
|
69
69
|
## Contributing
|
70
70
|
|
71
|
-
1. Fork it ( https://github.com/
|
71
|
+
1. Fork it ( https://github.com/vendasta/sequel-snowflake/fork )
|
72
72
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
73
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
74
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -38,6 +38,13 @@ module Sequel
|
|
38
38
|
self
|
39
39
|
end
|
40
40
|
|
41
|
+
# Whether the MERGE statement is supported:
|
42
|
+
# https://github.com/jeremyevans/sequel/blob/master/lib/sequel/dataset/features.rb#L129
|
43
|
+
# Snowflake reference: https://docs.snowflake.com/en/sql-reference/sql/merge
|
44
|
+
def supports_merge?
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
41
48
|
# This is similar to the ODBC adapter's Dataset#convert_odbc_value, except for some special casing
|
42
49
|
# around Snowflake numerics, which come in through ODBC as Strings instead of Numbers.
|
43
50
|
# In those cases, we need to examine the column type as well as the scale,
|
data/sequel-snowflake.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.license = "MIT"
|
12
12
|
spec.summary = %q{Sequel adapter for Snowflake}
|
13
13
|
spec.description = spec.summary
|
14
|
-
spec.homepage = "https://github.com/
|
14
|
+
spec.homepage = "https://github.com/vendasta/sequel-snowflake"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
|
22
|
-
spec.add_runtime_dependency 'sequel'
|
22
|
+
spec.add_runtime_dependency 'sequel', '>= 5.58.0'
|
23
23
|
spec.add_runtime_dependency 'ruby-odbc'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'rake'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'securerandom'
|
2
2
|
|
3
3
|
describe Sequel::Snowflake::Dataset do
|
4
|
+
let(:db) { Sequel.connect(adapter: :snowflake, drvconnect: ENV['SNOWFLAKE_CONN_STR']) }
|
5
|
+
|
4
6
|
describe 'Converting Snowflake data types' do
|
5
7
|
# Create a test table with a reasonably-random suffix
|
6
|
-
let
|
7
|
-
let!(:db) { Sequel.connect(adapter: :snowflake, drvconnect: ENV['SNOWFLAKE_CONN_STR']) }
|
8
|
+
let(:test_table) { "SEQUEL_SNOWFLAKE_SPECS_#{SecureRandom.hex(10)}".to_sym }
|
8
9
|
|
9
10
|
before(:each) do
|
10
11
|
# Set timezone for parsing timestamps. This gives us a consistent timezone to test against below.
|
@@ -69,10 +70,46 @@ describe Sequel::Snowflake::Dataset do
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
73
|
+
describe 'MERGE feature' do
|
74
|
+
let(:target_table) { "SEQUEL_SNOWFLAKE_SPECS_#{SecureRandom.hex(10)}".to_sym }
|
75
|
+
let(:source_table) { "SEQUEL_SNOWFLAKE_SPECS_#{SecureRandom.hex(10)}".to_sym }
|
76
|
+
|
77
|
+
before(:each) do
|
78
|
+
db.create_table(target_table, :temp => true) do
|
79
|
+
String :str
|
80
|
+
String :str2
|
81
|
+
String :str3
|
82
|
+
end
|
83
|
+
|
84
|
+
db.create_table(source_table, :temp => true) do
|
85
|
+
String :from
|
86
|
+
String :to
|
87
|
+
String :whomst
|
88
|
+
end
|
89
|
+
|
90
|
+
db[target_table].insert({ str: 'foo', str2: 'foo', str3: 'phoo' })
|
91
|
+
db[target_table].insert({ str: 'baz', str2: 'foo', str3: 'buzz' })
|
92
|
+
db[source_table].insert({ from: 'foo', to: 'bar', whomst: 'me' })
|
93
|
+
end
|
94
|
+
|
95
|
+
after(:each) do
|
96
|
+
db.drop_table(target_table)
|
97
|
+
db.drop_table(source_table)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'can use MERGE' do
|
101
|
+
db[target_table].merge_using(source_table, str: :from).merge_update(str2: :to).merge
|
102
|
+
|
103
|
+
expect(db[target_table].select_all.all).to match_array([
|
104
|
+
{ str: 'foo', str2: 'bar', str3: 'phoo' },
|
105
|
+
{ str: 'baz', str2: 'foo', str3: 'buzz' }
|
106
|
+
])
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
72
110
|
describe '#explain' do
|
73
111
|
# Create a test table with a reasonably-random suffix
|
74
|
-
let
|
75
|
-
let!(:db) { Sequel.connect(adapter: :snowflake, drvconnect: ENV['SNOWFLAKE_CONN_STR']) }
|
112
|
+
let(:test_table) { "SEQUEL_SNOWFLAKE_SPECS_#{SecureRandom.hex(10)}".to_sym }
|
76
113
|
|
77
114
|
before(:each) do
|
78
115
|
db.create_table(test_table, :temp => true) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-snowflake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yesware, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.58.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.58.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-odbc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- spec/sequel/adapters/snowflake_spec.rb
|
105
105
|
- spec/snowflake_spec.rb
|
106
106
|
- spec/spec_helper.rb
|
107
|
-
homepage: https://github.com/
|
107
|
+
homepage: https://github.com/vendasta/sequel-snowflake
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
110
|
metadata: {}
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.3.
|
126
|
+
rubygems_version: 3.3.26
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Sequel adapter for Snowflake
|