postgres-copy 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -12
- data/lib/postgres-copy/acts_as_copy_target.rb +1 -1
- data/postgres-copy.gemspec +1 -1
- data/spec/copy_from_spec.rb +6 -0
- data/spec/fixtures/comma_with_header_to_map.csv +2 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfe11c5653d850edd47a3df54bcbb83600f820b35a297f05d363b6e89b8b27ff
|
4
|
+
data.tar.gz: 25a187d205ca18ad00e9a35de9a3fabc400137a56af61fce58eac5f7713491af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf7bdfb2fc14b24ede0973c7e573ed30507c77c205cfe87aa13f9302ad31d988360bcebec83b5ee1c83d266c14d8b42728fb17d5a07c222babc3aab5438562ce
|
7
|
+
data.tar.gz: b0f085dbbd1fbd684a00d97eda965f7074d52b8e8f0fe07657f33a5a5fcbd9ab4041a71956e640c5b40140c125675f20479044e1aea5b7bea1d1aba9d51e4227
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
postgres-copy (1.6.
|
4
|
+
postgres-copy (1.6.1)
|
5
5
|
activerecord (>= 5.1)
|
6
6
|
pg (>= 0.17)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (7.0.
|
12
|
-
activesupport (= 7.0.
|
13
|
-
activerecord (7.0.
|
14
|
-
activemodel (= 7.0.
|
15
|
-
activesupport (= 7.0.
|
16
|
-
activesupport (7.0.
|
11
|
+
activemodel (7.0.4)
|
12
|
+
activesupport (= 7.0.4)
|
13
|
+
activerecord (7.0.4)
|
14
|
+
activemodel (= 7.0.4)
|
15
|
+
activesupport (= 7.0.4)
|
16
|
+
activesupport (7.0.4)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.10)
|
22
22
|
diff-lcs (1.4.4)
|
23
|
-
i18n (1.
|
23
|
+
i18n (1.12.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
minitest (5.
|
26
|
-
pg (1.
|
25
|
+
minitest (5.16.3)
|
26
|
+
pg (1.4.3)
|
27
27
|
rake (11.2.2)
|
28
28
|
rdoc (6.2.1)
|
29
29
|
rspec (2.99.0)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
rspec-expectations (2.99.2)
|
35
35
|
diff-lcs (>= 1.1.3, < 2.0)
|
36
36
|
rspec-mocks (2.99.4)
|
37
|
-
tzinfo (2.0.
|
37
|
+
tzinfo (2.0.5)
|
38
38
|
concurrent-ruby (~> 1.0)
|
39
39
|
|
40
40
|
PLATFORMS
|
@@ -108,7 +108,7 @@ module PostgresCopy
|
|
108
108
|
quoted_table_name
|
109
109
|
end
|
110
110
|
|
111
|
-
columns_list = columns_list.map{|c| options[:map][c.to_s] } if options[:map]
|
111
|
+
columns_list = columns_list.map{|c| options[:map][c.to_s] || c.to_s } if options[:map]
|
112
112
|
columns_string = columns_list.size > 0 ? "(\"#{columns_list.join('","')}\")" : ""
|
113
113
|
connection.raw_connection.copy_data %{COPY #{table} #{columns_string} FROM STDIN #{options_string}} do
|
114
114
|
if options[:format] == :binary
|
data/postgres-copy.gemspec
CHANGED
data/spec/copy_from_spec.rb
CHANGED
@@ -14,6 +14,12 @@ describe "COPY FROM" do
|
|
14
14
|
TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
15
15
|
end
|
16
16
|
|
17
|
+
it "should import from file if path is with a field_map" do
|
18
|
+
TestModel.copy_from File.expand_path('spec/fixtures/comma_with_header_to_map.csv'), map: {'ref' => 'id'}
|
19
|
+
TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
20
|
+
end
|
21
|
+
|
22
|
+
|
17
23
|
it "should import from IO without field_map" do
|
18
24
|
TestModel.copy_from File.open(File.expand_path('spec/fixtures/comma_with_header.csv'), 'r')
|
19
25
|
TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres-copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diogo Biazus
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- spec/fixtures/comma_with_header_and_scope.csv
|
128
128
|
- spec/fixtures/comma_with_header_empty_values_at_the_end.csv
|
129
129
|
- spec/fixtures/comma_with_header_multi.csv
|
130
|
+
- spec/fixtures/comma_with_header_to_map.csv
|
130
131
|
- spec/fixtures/comma_without_header.csv
|
131
132
|
- spec/fixtures/extra_field.rb
|
132
133
|
- spec/fixtures/reserved_word_model.rb
|
@@ -151,7 +152,7 @@ files:
|
|
151
152
|
homepage: http://github.com/diogob/postgres-copy
|
152
153
|
licenses: []
|
153
154
|
metadata: {}
|
154
|
-
post_install_message:
|
155
|
+
post_install_message:
|
155
156
|
rdoc_options: []
|
156
157
|
require_paths:
|
157
158
|
- lib
|
@@ -166,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
167
|
- !ruby/object:Gem::Version
|
167
168
|
version: '0'
|
168
169
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
170
|
-
signing_key:
|
170
|
+
rubygems_version: 3.1.6
|
171
|
+
signing_key:
|
171
172
|
specification_version: 4
|
172
173
|
summary: Put COPY command functionality in ActiveRecord's model class
|
173
174
|
test_files: []
|