pg_csv 0.1.10 → 0.2
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 +4 -4
- data/README.md +4 -4
- data/lib/pg_csv.rb +2 -2
- data/lib/pg_csv/version.rb +1 -1
- data/pg_csv.gemspec +3 -4
- data/spec/spec_support.rb +1 -0
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ac7ea2066b378cdd5929bdf66a725de75346ee0
|
4
|
+
data.tar.gz: bf2309681d11975435e26ae4492da37ef0e5e74f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f4534196135858cc4d8cdcb76ccc2fc780b113ecd22e100f0c0e8cc16a1402f9af2383409cee41f14cb0113392e6dc2f1be9c4b715a2bad14455fca72d0d5ae
|
7
|
+
data.tar.gz: 0882b31d2b7c1d63ca7209a90aab4041257abe05d5538b729b5d3bc02158ba5872b33f862bd9fe5ed7eac320be6effdb132d1f6139054b9d33cd0acc71c6884f
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PgCsv
|
2
2
|
=====
|
3
3
|
|
4
|
-
Fast
|
4
|
+
Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows.
|
5
5
|
|
6
6
|
Gemfile:
|
7
7
|
``` ruby
|
@@ -17,8 +17,8 @@ PgCsv.new(opts).export(to, opts)
|
|
17
17
|
|
18
18
|
Options:
|
19
19
|
``` ruby
|
20
|
-
:sql => "select
|
21
|
-
:connection =>
|
20
|
+
:sql => plain sql ("select id, name from users")
|
21
|
+
:connection => ActiveRecord::Base.connection or PG::Connection(gem pg)
|
22
22
|
:delimiter => ["\t", ",", ]
|
23
23
|
:header => boolean, use pg header for fields?
|
24
24
|
:logger => logger
|
@@ -38,7 +38,7 @@ Options:
|
|
38
38
|
|
39
39
|
Examples:
|
40
40
|
``` ruby
|
41
|
-
PgCsv.new(:sql =>
|
41
|
+
PgCsv.new(:sql => sql).export('a1.csv')
|
42
42
|
PgCsv.new(:sql => sql).export('a2.gz', :type => :gzip)
|
43
43
|
PgCsv.new(:sql => sql).export('a3.csv', :temp_file => true)
|
44
44
|
PgCsv.new(:sql => sql, :type => :plain).export
|
data/lib/pg_csv.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'pg'
|
2
2
|
require File.expand_path(File.join(File.dirname(__FILE__), 'pg_csv/version'))
|
3
3
|
|
4
4
|
class PgCsv
|
@@ -97,7 +97,7 @@ class PgCsv
|
|
97
97
|
|
98
98
|
def load_data
|
99
99
|
info "#{query}"
|
100
|
-
raw = connection.raw_connection
|
100
|
+
raw = connection.respond_to?(:raw_connection) ? connection.raw_connection : connection
|
101
101
|
count = 0
|
102
102
|
|
103
103
|
info "=> query"
|
data/lib/pg_csv/version.rb
CHANGED
data/pg_csv.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ["Makarchev Konstantin"]
|
11
11
|
s.email = ["kostya27@gmail.com"]
|
12
12
|
s.homepage = "http://github.com/kostya/pg_csv"
|
13
|
-
s.summary = "Fast
|
14
|
-
s.description = "Fast
|
13
|
+
s.summary = "Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows."
|
14
|
+
s.description = "Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows."
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.license = "MIT"
|
21
21
|
|
22
22
|
s.add_dependency "pg", '~> 0.17'
|
23
|
-
s.add_dependency "activerecord"
|
24
23
|
s.add_development_dependency "rspec", '<3'
|
25
24
|
s.add_development_dependency "rake"
|
26
|
-
|
25
|
+
s.add_development_dependency "activerecord"
|
27
26
|
end
|
data/spec/spec_support.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makarchev Konstantin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -25,35 +25,35 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
33
|
+
version: '3'
|
34
|
+
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "<"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Fast
|
70
|
-
|
69
|
+
description: Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on
|
70
|
+
millions rows.
|
71
71
|
email:
|
72
72
|
- kostya27@gmail.com
|
73
73
|
executables: []
|
@@ -111,8 +111,8 @@ rubyforge_project:
|
|
111
111
|
rubygems_version: 2.2.2
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
|
-
summary: Fast
|
115
|
-
|
114
|
+
summary: Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions
|
115
|
+
rows.
|
116
116
|
test_files:
|
117
117
|
- spec/benchmark/bench.rb
|
118
118
|
- spec/benchmark/raw_bench.rb
|