Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ gem "rake"
gem "rspec"
gem "pry"
gem "dotenv"

group :development do
gem "parallel"
end
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ruby_snowflake_client (1.1.0)
ruby_snowflake_client (1.3.0)

GEM
remote: https://rubygems.org/
Expand All @@ -10,6 +10,7 @@ GEM
diff-lcs (1.5.0)
dotenv (2.8.1)
method_source (1.0.0)
parallel (1.23.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -34,6 +35,7 @@ PLATFORMS
DEPENDENCIES
bundler
dotenv
parallel
pry
rake
rspec
Expand Down
7 changes: 6 additions & 1 deletion ext/vendor/github.com/snowflakedb/gosnowflake/errors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ruby_snowflake_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RubySnowflakeClient
VERSION = '1.2.1'
VERSION = '1.3.0'
end
43 changes: 43 additions & 0 deletions spec/snowflake/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,50 @@
sql: query
)
end
end

context "for unauthorized database" do
before do
client.connect(
account: ENV["SNOWFLAKE_ACCOUNT"],
warehouse: ENV["SNOWFLAKE_WAREHOUSE"],
user: ENV["SNOWFLAKE_USER"],
password: ENV["SNOWFLAKE_PASSWORD"],
)
end
let(:query) { "SELECT * FROM TEST_DATABASE.RINSED_WEB_APP.EMAILS LIMIT 1;" }
it "should raise an exception" do
expect { result }.to raise_error do |error|
expect(error).to be_a Snowflake::Error
expect(error.message).to include "TEST_DATABASE"
expect(error.sentry_context).to include(
sql: query
)
end
end

it "should raise the correct exception for threaded work" do
require "parallel"

Parallel.map((1..3).collect { _1 }, in_threads: 2) do |idx|
c = described_class.new
c.connect(
account: ENV["SNOWFLAKE_ACCOUNT"],
warehouse: ENV["SNOWFLAKE_WAREHOUSE"],
user: ENV["SNOWFLAKE_USER"],
password: ENV["SNOWFLAKE_PASSWORD"],
)
query = "SELECT * FROM TEST_DATABASE#{idx}.RINSED_WEB_APP.EMAILS LIMIT 1;"

expect { c.fetch(query) }.to raise_error do |error|
expect(error).to be_a Snowflake::Error
expect(error.sentry_context).to include(
sql: query
)
expect(error.message).to include "TEST_DATABASE#{idx}"
end
end
end
end
end

Expand Down