data_kit 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/data_kit/csv/schema_analyzer.rb +2 -1
- data/lib/data_kit/version.rb +1 -1
- data/spec/csv/schema_analyzer_spec.rb +22 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fdf7cb54e3359090864cc1f2021822a91b382ba
|
4
|
+
data.tar.gz: 065fc5738cad3b21dfd62a79474b326ee2722bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d0283c91997c819063e7f7b38aee1cba5a97f8f6c43acc1d321d50945a5728607e2bcf44ae994ba6d7731b46e0e016bc13d0ef765a49348c3f6a6987b6e1297
|
7
|
+
data.tar.gz: 5f8b249b33841efcd8d38e4a899ce7a4465b6dcd08c05d77bcb4f42f82bc24f9f957cf319c5cf8c84f83e8c84c2bea854e93206d1fee901f229bc8c690c989c5
|
data/Gemfile.lock
CHANGED
@@ -40,7 +40,8 @@ module DataKit
|
|
40
40
|
def analyze(csv, options = {})
|
41
41
|
analyzer = new(csv,
|
42
42
|
:keys => options[:keys],
|
43
|
-
:sampling_rate => options[:sampling_rate]
|
43
|
+
:sampling_rate => options[:sampling_rate],
|
44
|
+
:use_type_hints => options[:use_type_hints]
|
44
45
|
)
|
45
46
|
|
46
47
|
analyzer.execute
|
data/lib/data_kit/version.rb
CHANGED
@@ -58,7 +58,28 @@ describe DataKit::CSV::SchemaAnalyzer do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should execute an analysis without type hints" do
|
61
|
-
analysis = DataKit::CSV::SchemaAnalyzer.new(csv,
|
61
|
+
analysis = DataKit::CSV::SchemaAnalyzer.new(csv,
|
62
|
+
:sampling_rate => 0.5, :use_type_hints => false).execute
|
63
|
+
|
64
|
+
analysis.type?('id').should == :integer
|
65
|
+
analysis.type?('first_name').should == :string
|
66
|
+
analysis.type?('last_name').should == :string
|
67
|
+
analysis.type?('email').should == :string
|
68
|
+
analysis.type?('country').should == :string
|
69
|
+
analysis.type?('ip_address').should == :string
|
70
|
+
analysis.type?('amount').should == :number
|
71
|
+
analysis.type?('active').should == :boolean
|
72
|
+
analysis.type?('activated_at').should == :datetime
|
73
|
+
analysis.type?('address').should == :string
|
74
|
+
|
75
|
+
analysis.row_count.should == 10
|
76
|
+
analysis.sample_count.should be < 10
|
77
|
+
analysis.use_type_hints.should == false
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should execute an analysis with the convenience method" do
|
81
|
+
analysis = DataKit::CSV::SchemaAnalyzer.analyze(csv,
|
82
|
+
:sampling_rate => 0.5, :use_type_hints => false)
|
62
83
|
|
63
84
|
analysis.type?('id').should == :integer
|
64
85
|
analysis.type?('first_name').should == :string
|