Skip to content

Commit

Permalink
Rewrite it all in rust (#3)
Browse files Browse the repository at this point in the history
* Rewrite it all in rust

* inline this, it's very simple

* Ignore whitespace when skipping lines

* This is no longer rust specific

* multiple tables, wowa!

* cargo fmt

* this fits on one line

* simple completer, will add more words and column names later

* autocomplete the column names too!
  • Loading branch information
alex authored Dec 31, 2016
1 parent 794d4d9 commit 964cf27
Show file tree
Hide file tree
Showing 7 changed files with 464 additions and 102 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
287 changes: 287 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "csvsql"
version = "0.1.0"
authors = ["Alex Gaynor <[email protected]>"]

[dependencies]
csv = "*"
prettytable-rs = "*"
regex = "*"
rust-sqlite = "*"
rustyline = "*"
14 changes: 9 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ Take a CSV file, query it with SQL. Magic!

.. code-block:: console
$ python csvsql.py file.csv
$ cargo run file.csv
Loaded 3162 rows into t(domain, base_domain, agency, sslv2)
> SELECT COUNT(*) FROM t
+----------+
| count(*) |
+----------+
| 3162 |
+----------+
All your rows go into a table named ``t``. It's great!

Error handling is bad, and the repl is super janky, no readline or anything
pleasant yet.
You can also specific multiple files:

.. code-block:: console
$ cargo run file1.csv file2.csv
Loaded 12 rows into t1(some, schema)
Loaded 74 rows into t2(some, other, schema)
>
Loading

0 comments on commit 964cf27

Please sign in to comment.