dataduck 0.5.2 → 0.5.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e4c2dcce049fc3bf3c8d9825b07154ffe0bdf5c
4
- data.tar.gz: 0759d5be8059eb22e08f85367fb15df1c601bb47
3
+ metadata.gz: 3699a208eb034218604e769002f04ccf9abdb1cc
4
+ data.tar.gz: e2be32191496db32f1102515ff139d00a00dc888
5
5
  SHA512:
6
- metadata.gz: dc9a7a2a94b204ecc367da5666520dfdfc06129ff7118821c873b275a8fe6f55bffa5bda78380dd6b34aa603612e68b35e646c9d4e40b6f817875f7bd9d50ce2
7
- data.tar.gz: 91b3769be124f595411bf55b53359d6fc2914db6c44752bd514750ac1be848b94b8ee2317a0546eecf04303ccc18e4a58279ec6a24a5b67c4e49e2b6903ebb5b
6
+ metadata.gz: 058285c16c15488abc3bc721fa8ed27c6a4b13330d0e6cfaf272a7912566690518ac4aafd8a22d3a44304795a073e80e40fd8d6a8f92811fd1a0d0b05f5c87d0
7
+ data.tar.gz: 9cc2c2335d8c49b685b7825c00f4515139ee3fa46d266c825755f686df4fed43cb35aea63eb1102306bd7ce9cd964585e835bdcdf9b991ce9f10ec98d86ea0a8
@@ -120,8 +120,8 @@ module DataDuck
120
120
  base_query = source_spec.has_key?(:query) ? source_spec[:query] :
121
121
  "SELECT #{ escape_char }#{ source_spec[:columns].sort.join(escape_char + ',' + escape_char) }#{ escape_char } FROM #{ source_spec[:table_name] }"
122
122
 
123
- extract_by_clause = ""
124
- limit_clause = ""
123
+ extract_part = ""
124
+ limit_part = self.limit_clause
125
125
 
126
126
  if self.extract_by_column
127
127
  if destination.table_names.include?(self.building_name)
@@ -129,15 +129,27 @@ module DataDuck
129
129
  extract_by_value = destination.query("SELECT MAX(#{ extract_by_column_without_table }) AS val FROM #{ self.building_name }").first
130
130
  extract_by_value = extract_by_value.nil? ? nil : extract_by_value[:val]
131
131
 
132
- if extract_by_value
133
- extract_by_clause = "WHERE #{ self.extract_by_column } >= '#{ extract_by_value }'"
134
- end
132
+ extract_part = self.extract_by_clause(extract_by_value)
135
133
  end
134
+ end
135
+
136
+ [base_query, extract_part, limit_part].join(' ').strip
137
+ end
136
138
 
137
- limit_clause = self.batch_size ? "ORDER BY #{ self.extract_by_column } LIMIT #{ self.batch_size }" : ""
139
+ def extract_by_clause(value)
140
+ if value
141
+ "WHERE #{ self.extract_by_column } >= '#{ value }'"
142
+ else
143
+ ""
138
144
  end
145
+ end
139
146
 
140
- [base_query, extract_by_clause, limit_clause].join(' ').strip
147
+ def limit_clause
148
+ if self.extract_by_column && self.batch_size
149
+ "ORDER BY #{ self.extract_by_column } LIMIT #{ self.batch_size }"
150
+ else
151
+ ""
152
+ end
141
153
  end
142
154
 
143
155
  def indexes
@@ -1,6 +1,6 @@
1
1
  module DataDuck
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 5
4
- VERSION_PATCH = 2
4
+ VERSION_PATCH = 3
5
5
  VERSION = [VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH].join('.')
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dataduck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pickhardt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler