idata 0.2.4 → 0.2.5

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: a65ffab6dcd5b46ea706e0234d603432d8dfe967
4
- data.tar.gz: 375b06bd1ba205618418c0fd536ea241cf59dc10
3
+ metadata.gz: c78854c8366bba688c067558f460eaebbc5e8900
4
+ data.tar.gz: 20c21a061c5366251c7074ebe9288095e8f660cc
5
5
  SHA512:
6
- metadata.gz: 1e35c422fa9eae8475d33b750022f236ec74e0f1f95fd4baff680abaec9f7d2ff1c6ef436a183c7c8d9d09cf35c3b0b4b4aed2bf4cb18d674356d16787024130
7
- data.tar.gz: 0c8838b2a6483870fec4289d4d8570e24e2da1af095a12d6ccdc274451b1b2ab55413f81e5f8916b80b50a2fb905d035b7a9d19a3fdfc8db53ba56055be06f19
6
+ metadata.gz: a9b1c1006cd1f1e9adc310e234a664e4fb9c73071f6705a96776af1122b0762e4d844d24d41da25aed47ecc036800c3110a9ae0f422bc0e9e2d69d7c4097a754
7
+ data.tar.gz: feef658f247d2ef71c34d4876490d4746fa17413a017dea7456896c3135ba27cf161f0e15eebec7ff51a87a18f9d23db84efcbabfbb4696588cb2f0f2e15104f
data/README2.md CHANGED
@@ -33,5 +33,35 @@ Supported rules include:
33
33
  | `custom query "query"` | Dùng custom SQL `query` (trong trường hợp business phức tạp không thể biểu diễn bằng các rule khác) | |
34
34
  | `reverse query "query"` | Reverse counterpart của `custom query` | |
35
35
 
36
+ Query the validation log
37
+ =========
38
+ Look at the illustration below for the schema of `log` table
39
+ ![log schema](https://s3-ap-southeast-1.amazonaws.com/mycdn1104/log.png)
40
+ #### Some common queries
41
+ List of IDL tables
42
+ ```
43
+ .tables
44
+ ```
45
+ List of tables and errors found
46
+ ```
47
+ SELECT distinct table_name, error FROM log;
48
+ ```
49
+ List of tables, errors and item count for every error
50
+ ```
51
+ SELECT table_name, error, count(*) FROM log GROUP BY table_name, error;
52
+ ```
53
+ List of tables and error count
54
+ ```
55
+ SELECT table_name, count(DISTINCT error) FROM log GROUP BY table_name;
56
+ ```
57
+ Delete `vendors` with a particular error:
58
+ ```
59
+ DELETE FROM vendors WHERE rowid IN (SELECT id FROM log WHERE error = 'invalid vendor name' AND table_name = 'vendors');
60
+ ```
61
+ Delete *all* `vendors` with error:
62
+ ```
63
+ DELETE FROM vendors WHERE rowid IN (SELECT id FROM log WHERE table_name = 'vendors');
64
+ ```
65
+
36
66
  ## Others
37
67
  TBD
data/bin/iload CHANGED
@@ -52,8 +52,8 @@ parser = OptionParser.new("", 24) do |opts|
52
52
  $options[:table] = v
53
53
  end
54
54
 
55
- opts.on("--append", "") do |v|
56
- $options[:append] = v
55
+ opts.on("--drop", "") do |v|
56
+ $options[:drop] = v
57
57
  end
58
58
 
59
59
  opts.on("-h", "--host HOST", "PostgreSQL host") do |v|
@@ -159,7 +159,7 @@ end
159
159
  $options[:listen] ||= POSTGRESQL_PORT
160
160
  $options[:delim] ||= CSV_DEFAULT_DELIMITER
161
161
  $options[:quote] ||= CSV_DEFAULT_QUOTE
162
- $options[:append] ||= false
162
+ $options[:drop] ||= false
163
163
 
164
164
  $tmpfile = "/tmp/#{Digest::SHA1.hexdigest(rand(100000).to_s)}.csv"
165
165
 
@@ -285,7 +285,7 @@ class MyParser
285
285
  end
286
286
 
287
287
  # Create table
288
- if !$options[:append]
288
+ if $options[:drop]
289
289
  drop_table_sql = "drop table if exists #{$options[:table]};"
290
290
  else
291
291
  drop_table_sql = ""
data/bin/imerge CHANGED
File without changes
data/lib/idata/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Idata
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nghi Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-07 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.4.6
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Data validation utilities