id,node_id,number,state,locked,title,user,body,created_at,updated_at,closed_at,merged_at,merge_commit_sha,assignee,milestone,draft,head,base,author_association,repo,url,merged_by,auto_merge 521287994,MDExOlB1bGxSZXF1ZXN0NTIxMjg3OTk0,203,open,0,changes to allow for compound foreign keys,1049910,"Add support for compound foreign keys, as per issue #117 Not sure if this is the right approach. In particular I'm unsure about: - the new `ForeignKey` class, which replaces the namedtuple in order to ensure that `column` and `other_column` are forced into tuples. The class does the job, but doesn't feel very elegant. - I haven't rewritten `guess_foreign_table` to take account of multiple columns, so it just checks for the first column in the foreign key definition. This isn't ideal. - I haven't added any ability to the CLI to add compound foreign keys, it's only in the python API at the moment. The PR also contains a minor related change that columns and tables are always quoted in foreign key definitions.",2020-11-16T00:30:10Z,2023-01-25T18:47:18Z,,,0507a9464314f84e9e58b1931c583df51d757d7c,,,0,5e43e31c2b9bcf6b5d1460b0f848fed019ed42a6,f1277f638f3a54a821db6e03cb980adad2f2fa35,FIRST_TIME_CONTRIBUTOR,140912432,https://github.com/simonw/sqlite-utils/pull/203,, 300286535,MDExOlB1bGxSZXF1ZXN0MzAwMjg2NTM1,45,closed,0,"Implemented table.lookup(...), closes #44",9599,,2019-07-23T13:03:30Z,2019-07-23T13:07:00Z,2019-07-23T13:07:00Z,2019-07-23T13:07:00Z,580502431614d3653c93249988290265f3163d4b,,,0,c0852ce018425450d6c040040f32729d41ff635c,f3a4c3d3ee6475a6caf3c9606656dbaf1df020b7,OWNER,140912432,https://github.com/simonw/sqlite-utils/pull/45,, 815164865,PR_kwDOCGYnMM4wlm3B,361,closed,0,--lines and --text and --convert and --import,9599,"Refs #356 Still TODO: - [x] Get `--lines` working, with tests - [x] Get `--text` working, with tests - [x] Get regular JSON import working with `--convert` with tests - [x] Get `--lines` working with `--convert` with tests - [x] Get `--text` working with `--convert` with tests - [x] Get `--csv` and `--tsv` import working with `--convert` with tests - [x] Get `--nl` working with `--convert` with tests - [x] Documentation for all of the above",2022-01-06T01:49:44Z,2022-01-06T06:37:03Z,2022-01-06T06:24:54Z,2022-01-06T06:24:54Z,413f8ed754e38d7b190de888c85fe8438336cb11,,,0,b7f0b88d49032a053f0de2dbba356ee1f3b949c0,f3fd8613113d21d44238a6ec54b375f5aa72c4e0,OWNER,140912432,https://github.com/simonw/sqlite-utils/pull/361,, 369394043,MDExOlB1bGxSZXF1ZXN0MzY5Mzk0MDQz,80,closed,0,on_create mechanism for after table creation,9599,"I need this for `geojson-to-sqlite`, in particular https://github.com/simonw/geojson-to-sqlite/issues/6",2020-01-31T03:38:48Z,2020-01-31T05:08:04Z,2020-01-31T05:08:04Z,,e6dc95d19348e72b28b42e73a18737cb2e4563e0,,,0,45bf0c25492c276bde0b85868ffb55f169375bd7,f7289174e66ae4d91d57de94bbd9d09fabf7aff4,OWNER,140912432,https://github.com/simonw/sqlite-utils/pull/80,, 445023326,MDExOlB1bGxSZXF1ZXN0NDQ1MDIzMzI2,118,closed,0,Add insert --truncate option,79913," Deletes all rows in the table (if it exists) before inserting new rows. SQLite doesn't implement a TRUNCATE TABLE statement but does optimize an unqualified DELETE FROM. This can be handy if you want to refresh the entire contents of a table but a) don't have a PK (so can't use --replace), b) don't want the table to disappear (even briefly) for other connections, and c) have to handle records that used to exist being deleted. Ideally the replacement of rows would appear instantaneous to other connections by putting the DELETE + INSERT in a transaction, but this is very difficult without breaking other code as the current transaction handling is inconsistent and non-systematic. There exists the possibility for the DELETE to succeed but the INSERT to fail, leaving an empty table. This is not much worse, however, than the current possibility of one chunked INSERT succeeding and being committed while the next chunked INSERT fails, leaving a partially complete operation.",2020-07-06T21:58:40Z,2020-07-08T17:26:21Z,2020-07-08T17:26:21Z,2020-07-08T17:26:21Z,ae4593316ccf5e42ad26f27033193834a7e696c8,,,0,332f7d770b84734dbed4842ab3ed24ee5b687889,f8277d0fb9c05a88a9ff01d996e31d55f0f0a645,CONTRIBUTOR,140912432,https://github.com/simonw/sqlite-utils/pull/118,, 1173049178,PR_kwDOCGYnMM5F609a,519,closed,0,Fixes breaking DEFAULT values,13819005,"Fixes #509, Fixes #336 Thanks for the great library! I fixed a bug that `sqlite-utils transform` breaks DEFAULT values. All tests already present passed with no changes, and I added some tests for this PR. In #509 case, fixed here. ```shell $ sqlite3 test.db << EOF CREATE TABLE mytable ( col1 TEXT DEFAULT 'foo', col2 TEXT DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) ) EOF $ sqlite3 test.db ""SELECT sql FROM sqlite_master WHERE name = 'mytable';"" CREATE TABLE mytable ( col1 TEXT DEFAULT 'foo', col2 TEXT DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) ) $ sqlite3 test.db ""INSERT INTO mytable DEFAULT VALUES; SELECT * FROM mytable;"" foo|2022-12-21 01:15:39.669 $ sqlite-utils transform test.db mytable --rename col1 renamedcol1 $ sqlite3 test.db ""SELECT sql FROM sqlite_master WHERE name = 'mytable';"" CREATE TABLE ""mytable"" ( [renamedcol1] TEXT DEFAULT 'foo', [col2] TEXT DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) # ← Non-String Value ) $ sqlite3 test.db ""INSERT INTO mytable DEFAULT VALUES; SELECT * FROM mytable;"" foo|2022-12-21 01:15:39.669 foo|2022-12-21 01:15:56.432 ``` And #336 case also fixed. Special values are described [here](https://www.sqlite.org/lang_createtable.html). > 3.2. The DEFAULT clause > ... A default value may also be one of the special case-independent keywords CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. ```shell $ echo 'create table bar (baz text, created_at timestamp default CURRENT_TIMESTAMP)' | sqlite3 foo.db $ sqlite3 foo.db SQLite version 3.39.5 2022-10-14 20:58:05 Enter "".help"" for usage hints. sqlite> .schema bar CREATE TABLE bar (baz text, created_at timestamp default CURRENT_TIMESTAMP); sqlite> .exit $ sqlite-utils transform foo.db bar --column-order baz $ sqlite3 foo.db SQLite version 3.39.5 2022-10-14 20:58:05 Enter "".help"" for usage hints. sqlite> .schema bar CREATE TABLE IF NOT EXISTS ""bar"" ( [baz] TEXT, [created_at] FLOAT DEFAULT CURRENT_TIMESTAMP ); sqlite> .exit $ sqlite-utils transform foo.db bar --column-order baz $ sqlite3 foo.db SQLite version 3.39.5 2022-10-14 20:58:05 Enter "".help"" for usage hints. sqlite> .schema bar CREATE TABLE IF NOT EXISTS ""bar"" ( [baz] TEXT, [created_at] FLOAT DEFAULT CURRENT_TIMESTAMP # ← Non-String Value ); ``` ---- :books: Documentation preview :books:: https://sqlite-utils--519.org.readthedocs.build/en/519/ ",2022-12-21T01:27:52Z,2023-05-08T21:13:37Z,2023-05-08T21:13:37Z,2023-05-08T21:13:37Z,6500fed8b2085869b9714ce3a08c30f61dc829ad,,,0,5e5c262fab69eb3c470afa57fc52d3d7d8beee7a,fc221f9b62ed8624b1d2098e564f525c84497969,CONTRIBUTOR,140912432,https://github.com/simonw/sqlite-utils/pull/519,, 1234321667,PR_kwDOCGYnMM5JkkED,526,closed,0,Fix repeated calls to `Table.convert()`,167893,"Fixes #525. All tests pass. There's perhaps a better way to name lambdas? There could be a collision if a caller passes a function with name like `lambda_123456`. SQLite [documentation](https://www.sqlite.org/appfunc.html) is a little, ah, lite on function name specs. If there is a character that can be used in place of underscore in a SQLite function name that is not permitted in a Python function identifier then that could be a good way to prevent accidental collisions. (I tried dash, colon, dot, no joy). Otherwise, there is little chance of this happening and if it should happen the risk is mitigated by now throwing an exception in the case of a (name, arity) collision without `replace=True`. ---- :books: Documentation preview :books:: https://sqlite-utils--526.org.readthedocs.build/en/526/ ",2023-02-09T00:14:49Z,2023-05-08T21:56:05Z,2023-05-08T21:53:58Z,2023-05-08T21:53:58Z,02f5c4d69d7b4baebde015c56e5bc62923f33314,,,0,486e0cc1cd67e98c22d1f125403144cdedfa3d58,fc221f9b62ed8624b1d2098e564f525c84497969,CONTRIBUTOR,140912432,https://github.com/simonw/sqlite-utils/pull/526,, 1235909998,PR_kwDOCGYnMM5Jqn1u,528,closed,0,Enable `Table.convert()` on falsey values,167893,"Fixes #527 ---- :books: Documentation preview :books:: https://sqlite-utils--528.org.readthedocs.build/en/528/ ",2023-02-10T00:04:09Z,2023-05-08T21:08:23Z,2023-05-08T21:08:23Z,,279fb2c85c6b3fc7b593aaf4245bd3a038bff5f0,,,0,a09df3844ab91b70cebb7b888fc07cb21dffd01c,fc221f9b62ed8624b1d2098e564f525c84497969,CONTRIBUTOR,140912432,https://github.com/simonw/sqlite-utils/pull/528,, 768796296,PR_kwDOCGYnMM4t0uaI,333,closed,0,Add functionality to read Parquet files.,2118708,"I needed this for a project of mine, and I thought it'd be useful to have it in sqlite-utils (It's also mentioned in #248 ). The current implementation works (data is read & data types are inferred correctly. I've added a single straightforward test case, but @simonw please let me know if there are any non-obvious flags/combinations I should test too.",2021-10-28T23:43:19Z,2021-11-25T19:47:35Z,2021-11-25T19:47:35Z,,eda2b1f8d2670c6ca8512e3e7c0150866bd0bdc6,,,0,50ec2e49dee3b09a48a7aef55eceaa3f752a52e7,fda4dad23a0494890267fbe8baf179e2b56ee914,NONE,140912432,https://github.com/simonw/sqlite-utils/pull/333,, 774610166,PR_kwDOCGYnMM4uK5z2,337,closed,0,Default values for `--attach` and `--param` options,771193,"It seems that `click` 8.x uses `None` as the default value for `multiple=True` options. This change makes the code forward-compatible with `click` 8.x. See this build failure for more info: https://hydra.nixos.org/build/156926608",2021-11-05T21:57:53Z,2021-11-05T22:33:03Z,2021-11-05T22:33:02Z,,eb8bf28da1794638a5693043cd5268f506a674d3,,,0,095fc64c5399d75d44d304571a21293d06d817f0,fda4dad23a0494890267fbe8baf179e2b56ee914,NONE,140912432,https://github.com/simonw/sqlite-utils/pull/337,,