pg_csv 0.1.10 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a104e54f42ee73ff35a94124f93e379b69f9669
4
- data.tar.gz: f43f120f032bdfc9afc04fe5018fbfd22b8d3e28
3
+ metadata.gz: 2ac7ea2066b378cdd5929bdf66a725de75346ee0
4
+ data.tar.gz: bf2309681d11975435e26ae4492da37ef0e5e74f
5
5
  SHA512:
6
- metadata.gz: 0b346123dc7faf7b1d0f136c3182deb90bbef3d49f8c8b650ae4ce98e368a9c3e3c5c19052dd9b5194d7e5bbd6ffdd9740c5434f9f5ab977c106d07fd91e39f6
7
- data.tar.gz: ea1b05e3bda8aca42f2014df7ba988f87e951f84daf3815af3a951e10b252848e11eb86d17b42377edc0a03c9c45b6e12f270849df631b5f51c1c7f283530d63
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 AR/PostgreSQL csv export. Uses pg function 'copy to csv'. Effective on millions rows.
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 p.* from users u, projects p where p.user_id = u.id order by email limit 10"
21
- :connection => AR.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 => User.good.to_sql).export('a1.csv')
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
@@ -1,4 +1,4 @@
1
- require 'active_record'
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"
@@ -1,3 +1,3 @@
1
1
  class PgCsv
2
- VERSION = "0.1.10"
2
+ VERSION = "0.2"
3
3
  end
@@ -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 AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective on millions rows."
14
- s.description = "Fast AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective on millions rows."
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
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'active_record'
2
3
 
3
4
  conn = {'adapter' => 'postgresql', 'database' => 'pgcsv_test', :encoding => "unicode"}
4
5
  ActiveRecord::Base.establish_connection conn
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.1.10
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-02 00:00:00.000000000 Z
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: activerecord
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
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: '0'
40
+ version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "<"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3'
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: '3'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
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 AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective
70
- on millions rows.
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 AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective
115
- on millions rows.
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