https://github.com/ckampfe/clog
csv + datalog
https://github.com/ckampfe/clog
Last synced: about 1 year ago
JSON representation
csv + datalog
- Host: GitHub
- URL: https://github.com/ckampfe/clog
- Owner: ckampfe
- License: epl-1.0
- Created: 2018-05-04T05:44:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T00:38:50.000Z (about 8 years ago)
- Last Synced: 2025-02-01T20:11:21.333Z (over 1 year ago)
- Language: Clojure
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clog
Query CSVs with datalog
## Installation
`$ boot build-native-image`
## Examples
```
xcxk066$> wc -l junk.csv
10001 junk.csv
xcxk066$> head -10 junk.csv
id,name,kind
1,bill,kind
2,sally,sad
3,ernie,eerie
4,jill,jolly
5,bill,kind
6,sally,sad
7,ernie,eerie
8,jill,jolly
9,bill,kind
xcxk066$> ./clog junk.csv -i -t "{:id :to-int}"
xcxk066$> time ./clog junk.csv -q '[:find ?name (count ?e) :where [?e :name ?name]]' -t '{:id :to-long}'
(["jill" 2500] ["ernie" 2500] ["sally" 2500] ["bill" 2500])
./clog junk.csv -q '[:find ?name (count ?e) :where [?e :name ?name]]' -t 0.14s user 0.03s system 98% cpu 0.175 total
```
## Usage
```
xcxk066$> ./clog
clog:
Usage: clog [options] file
Options:
-q, --query QUERY The query to run
-i, --index Create an index
-t, --typemap TYPEMAP A typemap of transforms
-s, --csv-separator CSV-SEPARATOR , CSV separator character
-u, --csv-quote CSV-QUOTE " CSV quote character
-o, --csv-header Show CSV header only
-v, --verbose Verbose mode
-h, --help
```
## License
Copyright © 2018 Clark Kampfe
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.