datamancer 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,7 +75,15 @@ module Datamancer
75
75
  @fields[field] = index
76
76
  end
77
77
 
78
- db.select_rows("SELECT #{columns} FROM #{table}")
78
+ # TODO: Test top.
79
+ # TODO: Top for CSV.
80
+ # TODO: Top for support several databases.
81
+
82
+ if args[:top]
83
+ db.select_rows("SELECT TOP #{args[:top]} #{columns} FROM #{table}" )
84
+ else
85
+ db.select_rows("SELECT #{columns} FROM #{table}")
86
+ end
79
87
  end
80
88
 
81
89
  output.map! do |array_row|
@@ -87,7 +95,6 @@ module Datamancer
87
95
  end
88
96
 
89
97
  if hash_row.has_value?(:reject)
90
- puts hash_row
91
98
  nil
92
99
  else
93
100
  hash_row
@@ -139,7 +146,7 @@ module Datamancer
139
146
  # [ ] Regexp
140
147
  # [x] String
141
148
  # [x] Symbol
142
- # [ ] Date
149
+ # [x] Date
143
150
  # [ ] DateTime
144
151
  # [ ] Time
145
152
  # [ ] TimeWithZone
@@ -157,6 +164,9 @@ module Datamancer
157
164
  value = value.to_s
158
165
  when 'Symbol'
159
166
  value = value.to_sym
167
+ when 'Date'
168
+ # From "1900-01-01 00:00:00.000" to "19000101".
169
+ value = value.gsub('-', '')[0..7]
160
170
  end
161
171
  end
162
172
 
@@ -74,7 +74,7 @@ module Datamancer
74
74
  # String values must be enclosed by single quotes.
75
75
  inserts.map! do |insert|
76
76
  insert.map! do |field|
77
- field.is_a?(String) ? "'#{field}'" : field
77
+ field.is_a?(String) ? "'#{field}'" : (field ? field : 'NULL')
78
78
  end
79
79
 
80
80
  "(#{insert.join(',')})"
@@ -30,6 +30,10 @@ module Datamancer
30
30
  end
31
31
  end
32
32
 
33
+ # TODO: Test this:
34
+
35
+ raise StandardError, 'Sadness: null join.' if output.empty?
36
+
33
37
  output
34
38
  end
35
39
 
@@ -1,3 +1,3 @@
1
1
  module Datamancer
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,99 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datamancer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Matías Battocchia
8
- autorequire:
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
12
+ date: 2013-12-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
+ version_requirements: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - ~>
18
19
  - !ruby/object:Gem::Version
19
20
  version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
+ none: false
28
+ prerelease: false
29
+ type: :development
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ none: false
29
38
  requirement: !ruby/object:Gem::Requirement
30
39
  requirements:
31
40
  - - '>='
32
41
  - !ruby/object:Gem::Version
33
42
  version: '0'
34
- type: :development
43
+ none: false
35
44
  prerelease: false
45
+ type: :development
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
36
48
  version_requirements: !ruby/object:Gem::Requirement
37
49
  requirements:
38
50
  - - '>='
39
51
  - !ruby/object:Gem::Version
40
52
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
53
+ none: false
43
54
  requirement: !ruby/object:Gem::Requirement
44
55
  requirements:
45
56
  - - '>='
46
57
  - !ruby/object:Gem::Version
47
58
  version: '0'
48
- type: :development
59
+ none: false
49
60
  prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ name: activerecord
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activerecord
69
+ none: false
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
72
  - - '>='
60
73
  - !ruby/object:Gem::Version
61
74
  version: '0'
62
- type: :development
75
+ none: false
63
76
  prerelease: false
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ name: sqlite3
64
80
  version_requirements: !ruby/object:Gem::Requirement
65
81
  requirements:
66
82
  - - '>='
67
83
  - !ruby/object:Gem::Version
68
84
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3
85
+ none: false
71
86
  requirement: !ruby/object:Gem::Requirement
72
87
  requirements:
73
88
  - - '>='
74
89
  - !ruby/object:Gem::Version
75
90
  version: '0'
76
- type: :development
91
+ none: false
77
92
  prerelease: false
93
+ type: :development
94
+ - !ruby/object:Gem::Dependency
95
+ name: activerecord-jdbcsqlite3-adapter
78
96
  version_requirements: !ruby/object:Gem::Requirement
79
97
  requirements:
80
98
  - - '>='
81
99
  - !ruby/object:Gem::Version
82
100
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: activerecord-jdbcsqlite3-adapter
101
+ none: false
85
102
  requirement: !ruby/object:Gem::Requirement
86
103
  requirements:
87
104
  - - '>='
88
105
  - !ruby/object:Gem::Version
89
106
  version: '0'
90
- type: :development
107
+ none: false
91
108
  prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
109
+ type: :development
97
110
  description: A magical extract, transform, load (ETL) library for data integration.
98
111
  email:
99
112
  - matias@riseup.net
@@ -125,8 +138,7 @@ files:
125
138
  homepage: https://github.com/matiasbattocchia/datamancer
126
139
  licenses:
127
140
  - MIT
128
- metadata: {}
129
- post_install_message:
141
+ post_install_message:
130
142
  rdoc_options: []
131
143
  require_paths:
132
144
  - lib
@@ -135,16 +147,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
147
  - - '>='
136
148
  - !ruby/object:Gem::Version
137
149
  version: '0'
150
+ none: false
138
151
  required_rubygems_version: !ruby/object:Gem::Requirement
139
152
  requirements:
140
153
  - - '>='
141
154
  - !ruby/object:Gem::Version
142
155
  version: '0'
156
+ none: false
143
157
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.0.2
146
- signing_key:
147
- specification_version: 4
158
+ rubyforge_project:
159
+ rubygems_version: 1.8.24
160
+ signing_key:
161
+ specification_version: 3
148
162
  summary: ''
149
163
  test_files:
150
164
  - spec/data/destination.csv
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7c61e73995d0dfa4c372c1142482044a3a55ceec
4
- data.tar.gz: 71968fed5543e5653ebf74e4b1f48f7e4576d5ef
5
- SHA512:
6
- metadata.gz: 4657f9b28e44d82e6ceff39cc9d59f10964255138c2542e3d828a3fa5201858a1932eedc0b55918abcfd9e469591527bfe1c42f10b88a7629b0faa10965b5615
7
- data.tar.gz: 382575e0b05be66f8f23b0c549895bc82e57a38575605bebf4cf196053f03d78b8ea9e52b7a4ff9f457ac8cb4917ee076178984ca315ad5b87e5635953f1f35a