Commit graph

47 commits

Author SHA1 Message Date
Simon Willison
6c3f5e6479 Added --table and --fmt options for table output using tabulate 2019-02-23 22:45:17 -08:00
Simon Willison
dbf239e3fc hash_id= mechanism for setting ID using content hash, closes #13 2019-02-23 20:36:40 -08:00
Simon Willison
e615d22c55
Support for numpy types, closes #11 (#12) 2019-02-23 20:02:19 -08:00
Simon Willison
ca225b02c0 Prettier indentation for CREATE TABLE 2019-02-23 12:52:04 -08:00
Simon Willison
e3c0ed1b1a sqlite-utils tables now takes --counts, --columns, --csv, --nl 2019-02-22 18:12:53 -08:00
Simon Willison
c7dbb03a10 Added 'sqlite-utils rows db.db tablename' command 2019-02-22 17:52:17 -08:00
Simon Willison
f2ca48c0da Default command now executes queries, --csv or --json
I replaced the following commands:

    sqlite-utils json db.db "select * from table"
    sqlite-utils csv db.db "select * from table"

With a unified 'query' command, which is now set as the default:

    sqlite-utils db.db "select * from table"
    sqlite-utils db.db "select * from table" --csv
2019-02-22 17:40:21 -08:00
Simon Willison
3095f2e671 Added db[table].rows iterator 2019-02-21 21:29:50 -08:00
Simon Willison
3f8ef35b2a enable-fts and populate-fts CLI commands 2019-02-07 21:18:24 -08:00
Simon Willison
f0afa5646b insert_all() now accepts generator, closes #7 2019-01-27 22:12:18 -08:00
Simon Willison
5309c5c775 sqlite-utils insert ... --nl option, closes #6 2019-01-27 18:17:38 -08:00
Simon Willison
57fc8ce55e Database() constructor works with pathlib.Path 2019-01-27 15:53:41 -08:00
Simon Willison
ea17c63cc5 Tests for json returning single row 2019-01-26 10:59:01 -08:00
Simon Willison
5466c9745d sqlite-utils json dogs.db "select * from dogs" 2019-01-25 18:06:29 -08:00
Simon Willison
c83dd8a5eb sqlite-utils csv data.db "select ..." command 2019-01-25 07:50:20 -08:00
Simon Willison
9501ba4bf1 sqlite-utils table_names blah.db is now tables blah.db
Travis tests were failing because on OS X the command was this:

   sqlite-utils table_names blah.db

But in Travis CI the command was this:

   sqlite-utils table-names blah.db

Renaming it to tables fixes this inconsistency.
2019-01-24 23:04:52 -08:00
Simon Willison
b30f924c49 Implemented 'sqlite-utils upsert my.db tablename --pk=x' 2019-01-24 21:20:10 -08:00
Simon Willison
9e74289397 'sqlite-utils insert tablename file.json' command 2019-01-24 21:06:41 -08:00
Simon Willison
1c683076d3 Sanity check test for optimize --no-vacuum 2019-01-24 20:38:23 -08:00
Simon Willison
0a8194e730 sqlite-utils optimize command, .optimize() and .detect_fts() table methods 2019-01-24 20:35:51 -08:00
Simon Willison
015bd2a840 Test for .table_names(fts5=True) 2019-01-24 20:23:53 -08:00
Simon Willison
66fd63b119 Ability to list just FTS4 or FTS5 table names 2019-01-24 19:57:04 -08:00
Simon Willison
231224ba1a Added vacuum to CLI and Python API 2019-01-24 19:39:04 -08:00
Simon Willison
fd5829b27d First CLI command: sqlite-utils table_names test.db 2019-01-24 19:30:47 -08:00
Simon Willison
8437fe3091 Revert "No need to skip black under Python 3.7 any more"
It turns out the black tests still fail in Travis against that version.

This reverts commit d18687a30a.
2019-01-24 19:08:52 -08:00
Simon Willison
d18687a30a No need to skip black under Python 3.7 any more 2019-01-24 19:02:30 -08:00
Simon Willison
228d595f7d Allow column names to be reserved words 2019-01-24 19:01:10 -08:00
Simon Willison
6ad9037c96 Added support for bytes and datetime.datetime 2019-01-24 18:59:21 -08:00
Simon Willison
8e2a313c1e Fixed failing FTS5 test, release as 0.6.1 2018-08-12 17:48:43 -07:00
Simon Willison
d1209a2c45 Use FTS4 when running the tests
Because the version of sqlite3 running in Travis CI does not have FTS5
2018-08-12 17:33:13 -07:00
Simon Willison
fcc38b9ff2 Moved fixtures into conftest.py 2018-08-12 17:25:39 -07:00
Simon Willison
02862be04c Default to FTS5 2018-08-12 17:21:55 -07:00
Simon Willison
9eacd30b1d New column_order= parameter for setting column order 2018-08-08 16:06:49 -07:00
Simon Willison
a86c3ee832 Added db.create_view(name, sql) method 2018-08-02 08:24:16 -07:00
Simon Willison
4427d2d96f table.create_index(columns, index_name) method 2018-08-01 08:20:44 -07:00
Simon Willison
c611ed80d2 .indexes property for introspecting indexes 2018-07-31 18:31:29 -07:00
Simon Willison
515d362ad6 .table_names and .tables properties plus expanded docs 2018-07-31 17:35:36 -07:00
Simon Willison
f4907f6df5 enable_fts(), populate_fts() and search() methods 2018-07-31 09:19:20 -07:00
Simon Willison
c446e22f34 Moved fixtures to fixtures.py, added .schema test 2018-07-31 08:55:24 -07:00
Simon Willison
5deb65f062 Now you just 'from sqlite_utils import Database'
Plus fixed ad_id in the Russian ads example in the docs
2018-07-30 20:30:23 -07:00
Simon Willison
b69f8b6c85 table.count property, plus made a start on table documentation 2018-07-30 20:24:35 -07:00
Simon Willison
e51f36d3eb Added table.foreign_keys property, fixed bug in foreign key creation 2018-07-28 15:41:18 -07:00
Simon Willison
95bce37ad3 Store list/dict/tuple values as JSON strings 2018-07-28 15:20:29 -07:00
Simon Willison
acea54877c Create table now works for pure m2m where both rows are foreign keys 2018-07-28 15:06:59 -07:00
Simon Willison
56e29158fe Don't run black test on Python 3.7
It breaks on that version - see https://github.com/ambv/black/issues/425

But that's OK, we only need it to run onder one version anyway.
2018-07-28 11:18:40 -07:00
Simon Willison
3c50a3600d Unit test for black-approved coding style 2018-07-28 07:29:20 -07:00
Simon Willison
bd71be32ab Initial project layout + database table creation tools 2018-07-28 06:46:17 -07:00