Commit graph

62 commits

Author SHA1 Message Date
Simon Willison
eff52023c6 alter=True/--alter option to automatically add missing columns
Closes #18
2019-05-24 17:41:04 -07:00
Simon Willison
05317f5341 Release 0.14 2019-02-24 15:11:51 -08:00
Simon Willison
3cab079d3e add-column col_type now optional, defaults to str 2019-02-24 14:24:00 -08:00
Simon Willison
557dc3f9a7 Improved foreign_keys= argument, closes #17 2019-02-24 14:12:45 -08:00
Simon Willison
f8d3b7cfe5 sqlite-utils add-foreign-key books.db books author_id authors id
Command for adding foreign keys to existing tables. Closes #2
2019-02-24 13:33:45 -08:00
Simon Willison
e1ca938aa1 table.add_foreign_key(column, other_table, other_column)
New mechanism for adding foreign key constraints to an existing SQLite
table.

SQLite ALTER TABLE does not support this out-of-the-box, so I instead
had to write some careful code that uses PRAGMA writable_schema = 1 to
directly modify the sqlite_master table.

Refs #2
2019-02-24 13:10:51 -08:00
Simon Willison
0bc49e938e 'sqlite-utils add-column name type' command, closes #15 2019-02-24 12:04:33 -08:00
Simon Willison
6d25f648ed add_column now accepts explicit SQLite types, refs #15 2019-02-24 11:49:31 -08:00
Simon Willison
dc2560879e table.add_column(name, type) method, refs #15 2019-02-24 11:40:26 -08:00
Simon Willison
8a5d0d80c3 sqlite-utils create-index command, closes #14 2019-02-24 11:11:21 -08:00
Simon Willison
7784b924a1 Added create_index(..., if_not_exists=True), refs #14 2019-02-24 10:46:44 -08:00
Simon Willison
0c6745b70f Whitespace fix 2019-02-24 10:42:27 -08:00
Simon Willison
e7ffbcdb36 Ability to create unique indexes, refs #14 2019-02-24 10:41:51 -08:00
Simon Willison
1b6025e8ab Release 0.13 2019-02-23 22:54:43 -08:00
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
Jeff Triplett
c5068a0972 📝 Updates my_database.py to my_database.db (#9) 2019-02-23 19:55:04 -08:00
Simon Willison
463fd3c3f6
Bump copyright year 2019-02-22 22:08:14 -08:00
Simon Willison
1ffa40301d Releasing 0.12 2019-02-22 18:22:28 -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
c89b2df918 Fixed documentation typo 2019-02-07 21:23:50 -08:00
Simon Willison
6acfd456b0 Releasing 0.11 2019-02-07 21:22:13 -08:00
Simon Willison
3f8ef35b2a enable-fts and populate-fts CLI commands 2019-02-07 21:18:24 -08:00
Simon Willison
7c09a2e994 Release 0.10 2019-02-06 21:17:52 -08:00
Simon Willison
79a0f9cc96 Releasing 0.9 2019-01-27 22:34:33 -08:00
Simon Willison
f0afa5646b insert_all() now accepts generator, closes #7 2019-01-27 22:12:18 -08:00
Simon Willison
225cf7299f Docs example chaining --nl together 2019-01-27 18:28:02 -08:00
Simon Willison
a226076994 Fixed RST bug 2019-01-27 18:18:55 -08:00
Simon Willison
5309c5c775 sqlite-utils insert ... --nl option, closes #6 2019-01-27 18:17:38 -08:00
Simon Willison
4e9045e5b0 Documentation typo 2019-01-25 18:19:15 -08:00
Simon Willison
3db4f08f19 Release 0.8 2019-01-25 18:13:29 -08:00
Simon Willison
5466c9745d sqlite-utils json dogs.db "select * from dogs" 2019-01-25 18:06:29 -08:00
Simon Willison
7689ca7229
Fixed RST formatting 2019-01-25 10:16:26 -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
e9e1cb00c1 Release notes for 0.7 2019-01-24 22:39:21 -08:00
Simon Willison
ffc9f09a93 Re-arranged documentation index page 2019-01-24 21:23:24 -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
0a8194e730 sqlite-utils optimize command, .optimize() and .detect_fts() table methods 2019-01-24 20:35:51 -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
594b25ef9f Started a changelog, releasing 0.6 2018-08-12 17:46:22 -07:00
Simon Willison
9fdf2c169c Documented Database(filepath) and in-memory database creation 2018-08-12 17:31:02 -07:00
Simon Willison
34a5c0e1e8 Documented insert_all() and upsert() and upsert_all()
Also re-titled main docs page to 'Python API'
2018-08-12 17:17:14 -07:00
Simon Willison
9eacd30b1d New column_order= parameter for setting column order 2018-08-08 16:06:49 -07:00