csvsql 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +59 -3
- data/lib/csvsql/db.rb +1 -1
- data/lib/csvsql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 399abac44119bfde664bcf81ac25f8c2b61271d8abefbdb616488ca21fbdc343
|
4
|
+
data.tar.gz: b7ffecdfe6a9fc94014bd23ebe1ce10928501d934bce6045eb0ccdaaf70ba6b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1455183640dda81a26234dfd2a072e4ef4e076776e62ad28727601d688493c49e42d264e3918226d1a661a4365f9f408f30a9fd30cc3e0beca2e1cd4f332df0e
|
7
|
+
data.tar.gz: 90ef8555cbfd7022f2acd8057a284c76f0ce697f125549aff58116ea028c1432e1f5a3ab8c518972d80bd3547cdfda8881c1846b9074dbf1af97699ca6ffafb7
|
data/README.md
CHANGED
@@ -90,10 +90,65 @@ csvsql --clear-cache
|
|
90
90
|
```
|
91
91
|
|
92
92
|
|
93
|
-
## Performance
|
93
|
+
## Performance (MBP 2016)
|
94
|
+
|
95
|
+
**Data**
|
96
|
+
|
97
|
+
```
|
98
|
+
title,desc,created_at:datetime
|
99
|
+
1asdfklajskdjfk alksd flka sdfkja sldfk ,lka sdfa sdlkfj alkr jl2kjlkajslkdfjak,2017-10-20 20:20
|
100
|
+
|
101
|
+
```
|
102
|
+
|
103
|
+
**10,000 lines**
|
104
|
+
|
105
|
+
```
|
106
|
+
$ time csvsql -i /tmp/a.csv "select count(*) from csv"
|
107
|
+
```
|
108
|
+
|
109
|
+
output
|
110
|
+
|
111
|
+
```
|
112
|
+
count(*)
|
113
|
+
100000
|
114
|
+
|
115
|
+
real 0m5.070s
|
116
|
+
user 0m4.776s
|
117
|
+
sys 0m0.256s
|
118
|
+
```
|
119
|
+
|
120
|
+
**10,000 lines with cache**
|
121
|
+
|
122
|
+
```
|
123
|
+
$ time csvsql -c -i /tmp/a.csv "select count(*) from csv"
|
124
|
+
```
|
125
|
+
|
126
|
+
Output
|
127
|
+
|
128
|
+
```
|
129
|
+
count(*)
|
130
|
+
100000
|
131
|
+
|
132
|
+
real 0m4.677s
|
133
|
+
user 0m4.309s
|
134
|
+
sys 0m0.253s
|
135
|
+
```
|
136
|
+
|
137
|
+
Second output
|
138
|
+
|
139
|
+
```
|
140
|
+
$ time csvsql -c -i /tmp/a.csv "select count(*) from csv"
|
141
|
+
```
|
142
|
+
|
143
|
+
```
|
144
|
+
count(*)
|
145
|
+
100000
|
146
|
+
|
147
|
+
real 0m0.502s
|
148
|
+
user 0m0.327s
|
149
|
+
sys 0m0.151s
|
150
|
+
```
|
94
151
|
|
95
|
-
* 10,000 lines
|
96
|
-
* 10,000 lines with cache
|
97
152
|
* 1,000,000 lines
|
98
153
|
* 1,000,000 lines with cache
|
99
154
|
|
@@ -110,3 +165,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
110
165
|
## License
|
111
166
|
|
112
167
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
168
|
+
/
|
data/lib/csvsql/db.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'digest'
|
4
|
+
require 'fileutils'
|
4
5
|
|
5
6
|
class Csvsql::Db
|
6
7
|
BATCH_ROWS = 10000
|
@@ -10,7 +11,6 @@ class Csvsql::Db
|
|
10
11
|
attr_reader :use_cache, :csv_path, :csv_io, :db, :batch_rows
|
11
12
|
|
12
13
|
def self.clear_cache!
|
13
|
-
require 'fileutils'
|
14
14
|
FileUtils.rm_f(Dir.glob(File.join(CACHE_DIR, '*')))
|
15
15
|
end
|
16
16
|
|
data/lib/csvsql/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiangzhi.xie
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.6
|
127
|
+
rubygems_version: 2.7.6
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Process csv with SQL.
|