csv-import-analyzer 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +8 -1
  4. data/csv-import-analyzer.gemspec +1 -1
  5. data/lib/csv-import-analyzer.rb +6 -4
  6. data/lib/csv-import-analyzer/analyzer/csv_check_bounds.rb +30 -19
  7. data/lib/csv-import-analyzer/analyzer/delimiter_identifier.rb +44 -24
  8. data/lib/csv-import-analyzer/analyzer/file_type_assertion.rb +1 -5
  9. data/lib/csv-import-analyzer/csv_datatype_analysis.rb +25 -9
  10. data/lib/csv-import-analyzer/csv_sanitizer.rb +67 -17
  11. data/lib/csv-import-analyzer/export/metadata_analysis.rb +63 -7
  12. data/lib/csv-import-analyzer/helpers/common_functions.rb +4 -0
  13. data/lib/csv-import-analyzer/helpers/datatype_validation.rb +6 -6
  14. data/lib/csv-import-analyzer/helpers/string_class_extensions.rb +9 -3
  15. data/lib/csv-import-analyzer/query_builder/mysql_query_helper.rb +2 -2
  16. data/lib/csv-import-analyzer/query_builder/pg_query_helper.rb +1 -2
  17. data/lib/csv-import-analyzer/query_builder/query_helper.rb +2 -2
  18. data/lib/csv-import-analyzer/sql_query_builder.rb +27 -12
  19. data/lib/csv-import-analyzer/version.rb +1 -1
  20. data/spec/csv-import-analyzer/analyzer/csv_check_bounds_spec.rb +8 -8
  21. data/spec/csv-import-analyzer/analyzer/delimiter_identifier_spec.rb +13 -13
  22. data/spec/csv-import-analyzer/csv_sanitizer_spec.rb +10 -7
  23. data/spec/csv-import-analyzer/helpers/common_functions_spec.rb +20 -19
  24. data/spec/csv-import-analyzer/helpers/datatype_validation_spec.rb +28 -28
  25. data/spec/csv-import-analyzer/helpers/string_class_extension_spec.rb +6 -6
  26. data/spec/csv-import-analyzer/query_builder/mysql_query_helper_spec.rb +13 -13
  27. data/spec/csv-import-analyzer/query_builder/pg_query_helper_spec.rb +16 -16
  28. data/spec/csv-import-analyzer_spec.rb +3 -6
  29. data/spec/fixtures/sample.csv +2 -2
  30. data/spec/spec_helper.rb +3 -0
  31. metadata +17 -6
  32. data/lib/csv-import-analyzer/sampleTab.csv +0 -5
  33. data/samples/metadata_output.json +0 -70
  34. data/spec/csv-import-analyzer/csv_datatype_analysis_spec.rb +0 -1
@@ -1,5 +0,0 @@
1
- Year ID,Make ID,Model ID,Description ID,Price ID
2
- 1997,Ford,,"ac, abs, moon","3000"
3
- 1999,Chevy,"Venture ""Extended Edition""","",4900.00
4
- 1999,"Chevy","Venture ""Extended Edition, Very Large""",,5000.00
5
- 1996,Jeep,Grand Che'rokee,"MUST SELL!air, moon roof, loaded",4799.00
@@ -1,70 +0,0 @@
1
- {
2
- "csv_file": {
3
- "filename": "sampleTab.csv",
4
- "file_size": 276,
5
- "record_delimiter": ","
6
- },
7
- "data_manipulations": {
8
- "replace_nulls": true,
9
- "replace_quotes": true
10
- },
11
- "csv_headers": {
12
- "year_id": {
13
- "datatype": "int",
14
- "datatype_analysis": {
15
- "int": 4
16
- },
17
- "distinct_values": [
18
- 1997,
19
- 1999,
20
- 1996
21
- ]
22
- },
23
- "make_id": {
24
- "datatype": "string",
25
- "datatype_analysis": {
26
- "string": 4
27
- },
28
- "distinct_values": [
29
- "Ford",
30
- "Chevy",
31
- "Jeep"
32
- ]
33
- },
34
- "model_id": {
35
- "datatype": "string",
36
- "datatype_analysis": {
37
- "string": 4
38
- },
39
- "distinct_values": "3+"
40
- },
41
- "description_id": {
42
- "datatype": "string",
43
- "datatype_analysis": {
44
- "string": 2
45
- },
46
- "distinct_values": [
47
- "ac, abs, moon",
48
- "MUST SELL!air, moon roof, loaded"
49
- ],
50
- "nullable": true
51
- },
52
- "price_id": {
53
- "datatype": "float",
54
- "datatype_analysis": {
55
- "float": 4
56
- },
57
- "distinct_values": "3+"
58
- }
59
- },
60
- "sql": {
61
- "pg": {
62
- "create_query": "create table sampletab.csv ( year_id int not null, make_id varchar(255) not null, model_id varchar(255) not null, description_id varchar(255), price_id float not null);",
63
- "import_query": "COPY sampletab.csv FROM '/home/avinash/Desktop/csv-import-analyzer/samples/sampleTab.csv' HEADER DELIMITER ',' CSV NULL AS 'NULL';"
64
- },
65
- "mysql": {
66
- "create_query": "create table sampletab.csv ( year_id int not null, make_id varchar(255) not null, model_id varchar(255) not null, description_id varchar(255), price_id float not null);",
67
- "import_query": "COPY sampletab.csv FROM '/home/avinash/Desktop/csv-import-analyzer/samples/sampleTab.csv' HEADER DELIMITER ',' CSV NULL AS 'NULL';"
68
- }
69
- }
70
- }
@@ -1 +0,0 @@
1
- # CsvImportAnalyzer::CsvDatatypeAnalysis.new({:delimiter => ",", :chunk => 20, :filename => "sampleTab.csv"}).datatype_analysis