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 +4 -4
- data/lib/dataduck/table.rb +19 -7
- data/lib/dataduck/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3699a208eb034218604e769002f04ccf9abdb1cc
|
4
|
+
data.tar.gz: e2be32191496db32f1102515ff139d00a00dc888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 058285c16c15488abc3bc721fa8ed27c6a4b13330d0e6cfaf272a7912566690518ac4aafd8a22d3a44304795a073e80e40fd8d6a8f92811fd1a0d0b05f5c87d0
|
7
|
+
data.tar.gz: 9cc2c2335d8c49b685b7825c00f4515139ee3fa46d266c825755f686df4fed43cb35aea63eb1102306bd7ce9cd964585e835bdcdf9b991ce9f10ec98d86ea0a8
|
data/lib/dataduck/table.rb
CHANGED
@@ -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
|
-
|
124
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
data/lib/dataduck/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|