jredshift 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -1
- data/jredshift.gemspec +1 -0
- data/lib/jredshift/version.rb +1 -1
- data/spec/dev_redshift.rb +16 -0
- data/spec/redshift_spec.rb +74 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d080c427b01705d8b15ee57188d4c8f94bea52
|
4
|
+
data.tar.gz: a9ffb5029b984c76fbb2981ec89eb1fd2d1442df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f837038cfe93d142cc35bec5f4c8488c8da05a8a5959e16b090c68c2dd046ceb68f16ac08473ddf1b2c53eb8fe688960d330fdd4a510670bd35b66665c9681
|
7
|
+
data.tar.gz: 643c3d2e6a5d68e49c325679f5191535a11084bf2e9a02e69a25f193c220b92de0c2c3b2413087885bd35698b685cd6d4c2656779ba4660625e0f062003a4fad
|
data/Rakefile
CHANGED
data/jredshift.gemspec
CHANGED
data/lib/jredshift/version.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
require_relative 'dev_redshift'
|
2
|
+
|
3
|
+
|
4
|
+
module Jredshift
|
5
|
+
describe 'Redshift' do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@db_conn = DevRedshift.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:all) do
|
12
|
+
@db_conn.drop_table_if_exists('test.tmp_drop_if_exists')
|
13
|
+
@db_conn.drop_table_if_exists('test.tmp_test_table')
|
14
|
+
@db_conn.drop_view_if_exists('test.tmp_test_table_vw')
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#drop_table_if_exists' do
|
18
|
+
|
19
|
+
it 'ignores a missing table' do
|
20
|
+
@db_conn.drop_table_if_exists('test.i_dont_exist')
|
21
|
+
expect(@db_conn.error_occurred?).to be false
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'drops an existing table' do
|
25
|
+
@db_conn.drop_table_if_exists('test.tmp_drop_if_exists')
|
26
|
+
@db_conn.execute('CREATE TABLE test.tmp_drop_if_exists (tmp boolean)')
|
27
|
+
@db_conn.drop_table_if_exists('test.tmp_drop_if_exists')
|
28
|
+
expect(@db_conn.error_occurred?).to be false
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'cascades when :cascade option is true' do
|
32
|
+
@db_conn.execute('CREATE TABLE test.tmp_test_table (tmp boolean)')
|
33
|
+
@db_conn.execute('CREATE VIEW test.tmp_test_table_vw AS SELECT * ' +
|
34
|
+
'FROM test.tmp_test_table')
|
35
|
+
@db_conn.drop_table_if_exists('test.tmp_test_table', :cascade => true)
|
36
|
+
sql = "SELECT count(*) FROM pg_views WHERE viewname = 'tmp_test_table_vw'"
|
37
|
+
|
38
|
+
count = @db_conn.query(sql).first['count']
|
39
|
+
expect(count).to eq(0)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#drop_view_if_exists' do
|
44
|
+
|
45
|
+
it 'ignores a missing view' do
|
46
|
+
@db_conn.drop_view_if_exists('test.i_dont_exist_vw')
|
47
|
+
expect(@db_conn.error_occurred?).to be false
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'drops an existing view' do
|
51
|
+
@db_conn.drop_table_if_exists('test.tmp_test_table', :cascade => true)
|
52
|
+
@db_conn.execute('CREATE TABLE test.tmp_test_table (tmp boolean)')
|
53
|
+
@db_conn.execute('CREATE VIEW test.tmp_drop_if_exists_vw AS SELECT * ' +
|
54
|
+
'FROM test.tmp_test_table')
|
55
|
+
@db_conn.drop_view_if_exists('test.tmp_drop_if_exists_vw')
|
56
|
+
@db_conn.execute('DROP TABLE test.tmp_test_table')
|
57
|
+
expect(@db_conn.error_occurred?).to be false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#get_field_by_type' do
|
62
|
+
|
63
|
+
it 'converts booleans correctly' do
|
64
|
+
@db_conn.execute('CREATE TABLE test.tmp_test_table (tmp boolean)')
|
65
|
+
@db_conn.execute('INSERT INTO test.tmp_test_table VALUES (true), (false)')
|
66
|
+
rows = @db_conn.query('SELECT * FROM test.tmp_test_table ORDER BY tmp')
|
67
|
+
@db_conn.drop_table_if_exists('test.tmp_test_table')
|
68
|
+
|
69
|
+
expect(rows[0]['tmp']).to be false
|
70
|
+
expect(rows[1]['tmp']).to be true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jredshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Morin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jdbc-postgres
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3'
|
55
69
|
description: |2
|
56
70
|
Convience wrapper for using Redshift with JRuby.
|
57
71
|
email:
|
@@ -71,6 +85,8 @@ files:
|
|
71
85
|
- lib/jredshift/jdbc_db.rb
|
72
86
|
- lib/jredshift/logger.rb
|
73
87
|
- lib/jredshift/version.rb
|
88
|
+
- spec/dev_redshift.rb
|
89
|
+
- spec/redshift_spec.rb
|
74
90
|
homepage: http://github.com/deanmorin/jredshift
|
75
91
|
licenses:
|
76
92
|
- The Unlicense
|
@@ -95,4 +111,6 @@ rubygems_version: 2.2.0
|
|
95
111
|
signing_key:
|
96
112
|
specification_version: 4
|
97
113
|
summary: Redshift wrapper for JRuby.
|
98
|
-
test_files:
|
114
|
+
test_files:
|
115
|
+
- spec/dev_redshift.rb
|
116
|
+
- spec/redshift_spec.rb
|