home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

96 rows where comments = 1, repo = 140912432 and user = 9599 sorted by updated_at descending

✖
✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: milestone, created_at (date), updated_at (date), closed_at (date)

type 2

  • issue 88
  • pull 8

state 2

  • closed 84
  • open 12

repo 1

  • sqlite-utils · 96 ✖
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association pull_request body repo type active_lock_reason performed_via_github_app reactions draft state_reason
1886783150 PR_kwDOCGYnMM5Z1H1d 593 .transform() now preserves rowid values, refs #592 simonw 9599 closed 0     1 2023-09-08T01:02:28Z 2023-09-10T17:44:59Z 2023-09-09T00:45:30Z OWNER simonw/sqlite-utils/pulls/593

Refs: - #592

  • [x] Tests against weird shaped tables

I need to test that this works against:

  • rowid tables
  • Tables that have a column called rowid even though they are not rowid tables

:books: Documentation preview :books:: https://sqlite-utils--593.org.readthedocs.build/en/593/

sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/593/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
1879214365 I_kwDOCGYnMM5wAokd 590 Ability to tell if a Database is an in-memory one simonw 9599 open 0     1 2023-09-03T19:50:15Z 2023-09-03T19:50:36Z   OWNER  

Currently the constructor accepts memory=True or memory_name=... and uses those to create a connection, but does not record what those values were:

https://github.com/simonw/sqlite-utils/blob/1260bdc7bfe31c36c272572c6389125f8de6ef71/sqlite_utils/db.py#L307-L349

This makes it hard to tell if a database object is to an in-memory or a file-based database, which is sometimes useful to know.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/590/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1868713944 I_kwDOCGYnMM5vYk_Y 588 `table.get(column=value)` option for retrieving things not by their primary key simonw 9599 open 0     1 2023-08-28T00:41:23Z 2023-08-28T00:41:54Z   OWNER  

This came up working on this feature: - https://github.com/simonw/llm/pull/186

I have a table with this schema: sql CREATE TABLE [collections] ( [id] INTEGER PRIMARY KEY, [name] TEXT, [model] TEXT ); CREATE UNIQUE INDEX [idx_collections_name] ON [collections] ([name]); So the primary key is an integer (because it's going to have a huge number of rows foreign key related to it, and I don't want to store a larger text value thousands of times), but there is a unique constraint on the name - that would be the primary key column if not for all of those foreign keys.

Problem is, fetching the collection by name is actually pretty inconvenient.

Fetch by numeric ID:

python try: table["collections"].get(1) except NotFoundError: # It doesn't exist Fetching by name: python def get_collection(db, collection): rows = db["collections"].rows_where("name = ?", [collection]) try: return next(rows) except StopIteration: raise NotFoundError("Collection not found: {}".format(collection)) It would be neat if, for columns where we know that we should always get 0 or one result, we could do this instead: python try: collection = table["collections"].get(name="entries") except NotFoundError: # It doesn't exist The existing .get() method doesn't have any non-positional arguments, so using **kwargs like that should work:

https://github.com/simonw/sqlite-utils/blob/1260bdc7bfe31c36c272572c6389125f8de6ef71/sqlite_utils/db.py#L1495

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/588/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1855836914 I_kwDOCGYnMM5undLy 583 Get rid of test.utils.collapse_whitespace simonw 9599 closed 0     1 2023-08-17T23:31:09Z 2023-08-18T00:59:19Z 2023-08-18T00:59:19Z OWNER  

I have a neater pattern for this now - instead of: https://github.com/simonw/sqlite-utils/blob/1dc6b5aa644a92d3654f7068110ed7930989ce71/tests/test_create.py#L472-L475

I now prefer:

https://github.com/simonw/sqlite-utils/blob/1dc6b5aa644a92d3654f7068110ed7930989ce71/tests/test_create.py#L1163-L1171

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/583/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1823160748 I_kwDOCGYnMM5sqzms 581 `sqlite-utils convert --pdb` option simonw 9599 closed 0     1 2023-07-26T21:02:50Z 2023-07-26T21:07:45Z 2023-07-26T21:06:10Z OWNER  

While using sqlite-utils convert I realized it would be handy if you could pass --pdb to have it open the debugger at the first instance of a failed conversion.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/581/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1816876211 I_kwDOCGYnMM5sS1Sz 571 `.transform(keep_table=...)` option simonw 9599 closed 0     1 2023-07-22T19:49:29Z 2023-07-22T22:32:18Z 2023-07-22T22:32:18Z OWNER  

Also need a design for an option for the .transform() method to indicate that the new table should be created with a new name without dropping the old one.

I think keep_table="name_of_table" is good for this.

Originally posted by @simonw in https://github.com/simonw/sqlite-utils/issues/565#issuecomment-1646657324

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/571/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1205687423 I_kwDOCGYnMM5H3VR_ 426 CLI docs should link to Python docs and vice versa simonw 9599 closed 0 simonw 9599   1 2022-04-15T16:05:15Z 2023-07-22T22:13:22Z 2023-07-22T22:13:22Z OWNER  

For every command/API method there should be a link to the equivalent in the other form factor.

Maybe also link to the API and CLI reference pages too.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/426/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1785360409 I_kwDOCGYnMM5qanAZ 563 `--empty-null` option when importing CSV simonw 9599 closed 0     1 2023-07-03T05:23:36Z 2023-07-03T05:44:43Z 2023-07-03T05:42:30Z OWNER  

CSV files with empty cells in (which come through as the empty string) are common and a bit gross.

Having an option that means "and if it's an empty string store null instead) would be cool.

I brainstormed name options here https://chat.openai.com/share/c947b738-ee7d-419c-af90-bc84e90987da

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/563/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1784794489 I_kwDOCGYnMM5qYc15 562 Explore the intersection between sqlite-utils and dataclasses simonw 9599 open 0     1 2023-07-02T19:23:08Z 2023-07-02T19:26:39Z   OWNER  

Aside: this makes me think it might be cool if sqlite-utils had a way of working with dataclasses rather than just dicts, and knew how to create a SQLite table to match a dataclass and maybe how to code-generate dataclasses for a specific table schema (dynamically or even using code-generation that can be written to disk, for better editor integrations).

Originally posted by @simonw in https://github.com/simonw/llm/issues/65#issuecomment-1616742529

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/562/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1777548699 I_kwDOCGYnMM5p8z2b 561 `--stop-after` option for `insert` and `upsert` commands simonw 9599 closed 0     1 2023-06-27T18:44:15Z 2023-06-27T18:50:09Z 2023-06-27T18:50:08Z OWNER  

I found myself wanting to insert rows from a 849MB CSV file without processing the whole thing: https://huggingface.co/datasets/jerpint-org/HackAPrompt-Playground-Submissions/tree/main

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/561/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1718612569 I_kwDOCGYnMM5mb_JZ 552 Document how to setup shell auto-completion simonw 9599 closed 0     1 2023-05-21T19:20:41Z 2023-05-21T21:05:16Z 2023-05-21T21:03:40Z OWNER  

https://click.palletsprojects.com/en/8.1.x/shell-completion/

This works for zsh:

eval "$(_SQLITE_UTILS_COMPLETE=zsh_source sqlite-utils)"

This will probably work for bash:

eval "$(_SQLITE_UTILS_COMPLETE=bash_source sqlite-utils)"

Need to add this to the installation docs here: https://sqlite-utils.datasette.io/en/stable/installation.html - along with the pattern for adding that to .zshrc or whatever.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/552/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1718576761 I_kwDOCGYnMM5mb2Z5 548 analyze-tables should validate provide --column names simonw 9599 closed 0     1 2023-05-21T17:20:24Z 2023-05-21T17:35:52Z 2023-05-21T17:35:52Z OWNER  

Noticed this while testing: - #547

If you pass a non-existent column to -c/--column you don't get an error message.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/548/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1718572201 I_kwDOCGYnMM5mb1Sp 547 No need to show common values if everything is null simonw 9599 closed 0     1 2023-05-21T17:05:07Z 2023-05-21T17:19:21Z 2023-05-21T17:19:21Z OWNER  

Noticed this:

``` % sqlite-utils analyze-tables content.db repos -c delete_branch_on_merge --common-limit 20 --no-least repos.delete_branch_on_merge: (1/1)

Total rows: 158 Null rows: 158 Blank rows: 0

Distinct values: 0

Most common: 158: None ```

The 158: None there is duplicate information considering we already know there are 158/158 null rows.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/547/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1700936245 I_kwDOCGYnMM5lYjo1 542 Remove `skip_false=True` and `--no-skip-false` in `sqlite-utils` 4.0 simonw 9599 open 0   4.0 backwards incomatible changes 9374594 1 2023-05-08T21:04:28Z 2023-05-08T21:07:41Z   OWNER  

Following: - #527

The only reason I didn't remove fix this mis-feature entirely is that it represents a backwards incompatible change. I'll make that change in 4.0.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/542/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1700840265 I_kwDOCGYnMM5lYMNJ 541 Get tests to pass with `pytest -Werror` simonw 9599 open 0     1 2023-05-08T19:57:23Z 2023-05-08T19:59:35Z   OWNER  

Inspired by: - #534

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/541/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1487757143 I_kwDOCGYnMM5YrV9X 517 Drop support for Python 3.6 simonw 9599 closed 0     1 2022-12-10T01:23:31Z 2022-12-10T01:36:36Z 2022-12-10T01:36:36Z OWNER  

CI has started failing for Python 3.6: https://github.com/simonw/sqlite-utils/actions/runs/3576322798

It's fixable by swiching away from ubuntu-latest according to:

  • https://github.com/actions/setup-python/issues/355#issuecomment-1335042510

But https://endoflife.date/python says that 3.6 end of life was almost 6 years ago, and end of security support nearly 1 year ago.

So I'm OK dropping support entirely - Python 3.6 users will still be able to install version 3.30, just not any releases that come next.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/517/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1423069384 I_kwDOCGYnMM5U0lDI 504 db.close() method, calling db.conn.close() simonw 9599 closed 0     1 2022-10-25T20:50:50Z 2022-10-25T21:00:29Z 2022-10-25T20:57:47Z OWNER  

I ended up needing to use db.conn.close() to fix this issue: - #503

I think .close() should be a method on Database itself.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/504/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1422954582 I_kwDOCGYnMM5U0JBW 502 Fix tests for Python 3.11 simonw 9599 closed 0     1 2022-10-25T19:20:31Z 2022-10-25T19:23:47Z 2022-10-25T19:23:47Z OWNER  

The way errors are represented has changed: https://github.com/simonw/sqlite-utils/actions/runs/3323588047/jobs/5494127154 ``` ____ testquery_invalid_function ______

db_path = '/tmp/pytest-of-runner/pytest-0/test_query_invalid_function0/test.db'

def test_query_invalid_function(db_path):
    result = CliRunner().invoke(
        cli.cli, [db_path, "select bad()", "--functions", "def invalid_python"]
    )
    assert result.exit_code == 1
  assert (
        result.output.strip()
        == "Error: Error in functions definition: invalid syntax (<string>, line 1)"
    )

E AssertionError: assert 'Error: Error...ing>, line 1)' == 'Error: Error...ing>, line 1)' E - Error: Error in functions definition: invalid syntax (<string>, line 1) E ? ^^^^^^ ^^^^^^ E + Error: Error in functions definition: expected '(' (<string>, line 1) E ? ^^^^^^^ ^^^ ```

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/502/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1386530156 I_kwDOCGYnMM5SpMVs 492 Idea: ability to pass extra variables to `--convert` scripts simonw 9599 open 0     1 2022-09-26T18:30:45Z 2022-09-26T18:33:19Z   OWNER  

Got this idea from this example in https://jeqo.github.io/notes/2022-09-24-ingest-logs-sqlite/

bash sqlite-utils insert /tmp/kafka-logs.db logs server.log.2022-09-24-21 --text --convert " import re r = re.compile(r'^\[(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\] (?P<level>\w+) (?P<log>(.+(\n(?\!\[).+|)+))', re.MULTILINE) def convert(text): rows = [m.groupdict() for m in r.finditer(text)] for row in rows: row.update({'server': 'localhost'}) row.update({'component': 'broker'}) return rows " And the accompanying note:

The row.update allows to label rows as I’m planning to ingest logs from different hosts and potentially different components.

This made me think: it might be neat if you could inject additional variable values into that script with extra command-line options, to make this kind of reuse easier. Something like this:

bash sqlite-utils insert /tmp/kafka-logs.db logs server.log.2022-09-24-21 --text --convert " import re r = re.compile(r'^\[(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\] (?P<level>\w+) (?P<log>(.+(\n(?\!\[).+|)+))', re.MULTILINE) def convert(text): rows = [m.groupdict() for m in r.finditer(text)] for row in rows: row.update({'server': server}) row.update({'component': component}) return rows " --var server "localhost" --var component "broker"

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/492/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1353481513 I_kwDOCGYnMM5QrH0p 478 `sqlite-utils tables data.db table1 table2` simonw 9599 open 0     1 2022-08-28T22:05:53Z 2022-08-28T22:22:35Z   OWNER  

The sqlite-utils tables command currently lists all tables.

If you have a huge table in there then running it with --counts can get expensive, because of the huge table.

Would be useful if it could accept an optional list of tables that it should execute against, as an alternative to the default of all of them.

This should be a backwards compatible change. Current design is: https://sqlite-utils.datasette.io/en/stable/cli-reference.html#tables

``` Usage: sqlite-utils tables [OPTIONS] PATH

List the tables in the database

Example:

  sqlite-utils tables trees.db

```

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/478/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1353189941 I_kwDOCGYnMM5QqAo1 475 table.default_values introspection property simonw 9599 closed 0   3.29 8355157 1 2022-08-27T22:33:31Z 2022-08-27T22:44:46Z 2022-08-27T22:43:02Z OWNER  

Interesting challenge with default_value: I need to be able to tell if the default values passed to .create() differ from those in the database already.

Introspecting that is a bit tricky:

```pycon

import sqlite_utils db = sqlite_utils.Database(memory=True) db["blah"].create({"id": int, "name": str}, not_null=("name",), defaults={"name": "bob"}) <Table blah (id, name)> db["blah"].columns [Column(cid=0, name='id', type='INTEGER', notnull=0, default_value=None, is_pk=0), Column(cid=1, name='name', type='TEXT', notnull=1, default_value="'bob'", is_pk=0)] `` Note how a default value of the Python stringbobis represented in the results ofPRAGMA table_info()asdefault_value="'bob'"` - it's got single quotes added to it!

So comparing default values from introspecting the database needs me to first parse that syntax. This may require a new table introspection method.

Originally posted by @simonw in https://github.com/simonw/sqlite-utils/issues/468#issuecomment-1229279539

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/475/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1352953535 PR_kwDOCGYnMM4950Az 473 Support entrypoints for `--load-extension` simonw 9599 closed 0     1 2022-08-27T05:53:59Z 2022-08-27T05:55:52Z 2022-08-27T05:55:47Z OWNER simonw/sqlite-utils/pulls/473

Refs #470


:books: Documentation preview :books:: https://sqlite-utils--473.org.readthedocs.build/en/473/

sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/473/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
1352931464 I_kwDOCGYnMM5QpBiI 469 sqlite-utils rows --order option simonw 9599 closed 0   3.29 8355157 1 2022-08-27T03:49:51Z 2022-08-27T04:30:49Z 2022-08-27T04:10:32Z OWNER  

For consistency with search: https://sqlite-utils.datasette.io/en/stable/cli-reference.html#search

-o, --order TEXT Order by ('column' or 'column desc')

I wanted to run sqlite-utils rows db.db mytable --order 'rowid desc' to see the most recently imported rows.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/469/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1320243134 I_kwDOCGYnMM5OsU-- 458 Support custom names for registered functions simonw 9599 closed 0   3.29 8355157 1 2022-07-28T00:13:00Z 2022-08-27T03:56:01Z 2022-07-28T00:13:57Z OWNER  

In this example:

```python @db.register_function def reverse_string(s): return "".join(reversed(list(s)))

print(db.execute('select reverse_string("hello")').fetchone()[0])

``` There's currently no way to over-ride the automatically selected name for the SQL function.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/458/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1326349129 I_kwDOCGYnMM5PDntJ 461 Consider including animated SVG console demos simonw 9599 open 0     1 2022-08-02T20:10:04Z 2022-08-02T20:12:14Z   OWNER  

I recorded this one using https://github.com/nbedos/termtosvg - with pipx install termtosvg and then termtosvg - execute demo - exit to save.

json [ { "id": 1, "name": "Catimus" }, { "id": 2, "name": "Feliopia" } ]

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/461/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1306548397 I_kwDOCGYnMM5N4Fit 454 CLI command for duplicating tables simonw 9599 closed 0     1 2022-07-15T21:31:27Z 2022-07-15T21:48:23Z 2022-07-15T21:45:51Z OWNER  

CLI equivalent of: - #449

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/454/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1215216249 I_kwDOCGYnMM5Ibrp5 428 Research adding support for savepoints simonw 9599 open 0     1 2022-04-26T01:04:01Z 2022-04-26T01:05:29Z   OWNER  

https://www.sqlite.org/lang_savepoint.html

Savepoints are like regular transactions except they have names and can be nested.

Would there be any value in adding support to them to sqlite-utils, potentially as some kind of context manager? Something like this: python with db.savepoint("name"): # do stuff with db.savepoint("name2"): # do more stuff raise Release # Rolls back to before "name2" savepoint I've never used this feature so I'm not comfortable adding anything like this without a bunch of extra research.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/428/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1200866134 I_kwDOCGYnMM5Hk8NW 424 Better error message if you try to create a table with no columns simonw 9599 closed 0     1 2022-04-12T02:43:20Z 2022-04-13T22:40:15Z 2022-04-13T22:40:10Z OWNER  

Seen here:

  • https://github.com/simonw/geojson-to-sqlite/issues/30

Attempting to create a table with no columns produced this confusing error:

File "/Users/simon/.local/pipx/venvs/geojson-to-sqlite/lib/python3.9/site-packages/geojson_to_sqlite/utils.py", line 69, in import_features db[table].create(column_types, pk=pk) File "/Users/simon/.local/pipx/venvs/geojson-to-sqlite/lib/python3.9/site-packages/sqlite_utils/db.py", line 863, in create self.db.create_table( File "/Users/simon/.local/pipx/venvs/geojson-to-sqlite/lib/python3.9/site-packages/sqlite_utils/db.py", line 517, in create_table self.execute(sql) File "/Users/simon/.local/pipx/venvs/geojson-to-sqlite/lib/python3.9/site-packages/sqlite_utils/db.py", line 236, in execute return self.conn.execute(sql) sqlite3.OperationalError: near ")": syntax error

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/424/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1181236173 I_kwDOCGYnMM5GaDvN 422 Reconsider not running convert functions against null values simonw 9599 open 0     1 2022-03-25T20:22:40Z 2022-03-25T20:23:21Z   OWNER  

I just got caught out by the fact that None values are not processed by the .convert() mechanism https://github.com/simonw/sqlite-utils/blob/0b7b80bd40fe86e4d66a04c9f607d94991c45c0b/sqlite_utils/db.py#L2504-L2510

I had run this code while working on #420 and I wasn't sure why it didn't work:

``` $ sqlite-utils add-column content.db articles score float $ sqlite-utils convert content.db articles score ' import random random.seed(10)

def convert(value): global random return random.random() ' `` The reason it didn't work is that the newly addedscorecolumn was full ofnull` values.

I fixed it by doing this instead:

$ sqlite-utils add-column content.db articles score float --not-null-default 1.0

But this indicates to me that the design of convert() here may be incorrect.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/422/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
688351054 MDU6SXNzdWU2ODgzNTEwNTQ= 140 Idea: insert-files mechanism for adding extra columns with fixed values simonw 9599 open 0     1 2020-08-28T20:57:36Z 2022-03-20T19:45:45Z   OWNER  

Say for example you want to populate a file_type column with the value gif. That could work like this:

sqlite-utils insert-files gifs.db images *.gif \ -c path -c md5 -c last_modified:mtime \ -c file_type:text:gif --pk=path So a column defined as a text column with a value that follows a second colon.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/140/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1125077063 I_kwDOCGYnMM5DD1BH 400 `sqlite-utils create-table` ... `--if-not-exists` simonw 9599 closed 0     1 2022-02-06T01:32:53Z 2022-02-06T01:34:53Z 2022-02-06T01:34:46Z OWNER  

Inspired by: - #397

To match the option on create-index: https://sqlite-utils.datasette.io/en/stable/cli-reference.html#create-index

--if-not-exists Ignore if index already exists

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/400/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1123849278 I_kwDOCGYnMM5C_JQ- 395 "apt-get: command not found" error on macOS simonw 9599 closed 0     1 2022-02-04T06:03:42Z 2022-02-04T06:10:58Z 2022-02-04T06:10:58Z OWNER  

Yeah, apt-get isn't a thing on macOS so 4a2a3e2fd0d5534f446b3f1fee34cb165e4d86d2 (to test #79 against real SpatiaLite) broke.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/395/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1118585417 I_kwDOCGYnMM5CrEJJ 393 Better documentation for insert-replace simonw 9599 closed 0     1 2022-01-30T15:40:23Z 2022-02-03T22:13:24Z 2022-02-03T22:13:24Z OWNER  

Currently: https://sqlite-utils.datasette.io/en/stable/python-api.html#insert-replacing-data

If you want to insert a record or replace an existing record with the same primary key, using the replace=True argument to .insert() or .insert_all():

Should describe the exception you get first, then how to use replace to avoid it.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/393/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1122446693 I_kwDOCGYnMM5C5y1l 394 Test against Python 3.11-dev simonw 9599 open 0     1 2022-02-02T22:21:03Z 2022-02-03T21:06:35Z   OWNER  

Same as: - https://github.com/simonw/datasette/issues/1621

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/394/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
   
1114557284 I_kwDOCGYnMM5Cbstk 390 `sqlite-utils upsert` should require `--pk` more elegantly simonw 9599 closed 0     1 2022-01-26T02:20:31Z 2022-01-26T03:20:25Z 2022-01-26T03:19:43Z OWNER  

Currently throws an ugly traceback: % echo '[ {"id": 1, "name": "Lila"}, {"id": 1, "name": "Lila"} ]' | sqlite-utils upsert data.db chickens - Traceback (most recent call last): File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/bin/sqlite-utils", line 33, in <module> sys.exit(load_entry_point('sqlite-utils', 'console_scripts', 'sqlite-utils')()) File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/lib/python3.8/site-packages/click/core.py", line 1137, in __call__ return self.main(*args, **kwargs) File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/lib/python3.8/site-packages/click/core.py", line 1668, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/simon/.local/share/virtualenvs/sqlite-utils-C4Ilevlm/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/cli.py", line 1104, in upsert insert_upsert_implementation( File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/cli.py", line 906, in insert_upsert_implementation db[table].insert_all( File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/db.py", line 2615, in insert_all raise PrimaryKeyRequired("upsert() requires a pk") sqlite_utils.db.PrimaryKeyRequired: upsert() requires a pk

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/390/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1111293050 I_kwDOCGYnMM5CPPx6 387 Python library docs should start with a self contained example simonw 9599 closed 0     1 2022-01-22T06:23:56Z 2022-01-26T01:37:17Z 2022-01-26T01:35:30Z OWNER  

You have to read a lot of stuff in a lot of different places to get started with the Python library. Add a getting started introduction to https://sqlite-utils.datasette.io/en/stable/python-api.html

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/387/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1099585611 I_kwDOCGYnMM5BilhL 382 `--where` option for `sqlite-rows` simonw 9599 closed 0     1 2022-01-11T20:24:23Z 2022-01-11T23:33:14Z 2022-01-11T23:32:47Z OWNER  

CLI equivalent of table.rows_where() - should accept parameters too. Work on this at the same time as #381.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/382/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1098574572 I_kwDOCGYnMM5Beurs 380 Release notes for 3.21 simonw 9599 closed 0   3.21 7558727 1 2022-01-11T02:12:30Z 2022-01-11T02:34:26Z 2022-01-11T02:34:26Z OWNER  

For these commits: https://github.com/simonw/sqlite-utils/compare/3.20...129141572f249ea290e2a075437e2ebaad215859

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/380/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1097129710 I_kwDOCGYnMM5BZN7u 372 Idea: `suffix` and `stem` file columns simonw 9599 closed 0   3.21 7558727 1 2022-01-09T07:48:53Z 2022-01-10T19:27:34Z 2022-01-09T20:17:00Z OWNER  

For https://sqlite-utils.datasette.io/en/stable/cli.html#inserting-data-from-files

Given a file called dogs.jpg stem would be dogs and ext would be jpg.

Need to decide what happens for dogs.and.cats.jpg.gz.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/372/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1072780607 I_kwDOCGYnMM4_8VU_ 351 Support `--import xml.etree.ElementTree` in `sqlite-utils convert` simonw 9599 closed 0     1 2021-12-07T00:40:29Z 2021-12-11T00:11:25Z 2021-12-11T00:11:25Z OWNER  

It's not possible to use a module that requires a nested import, such as xml.etree.ElementTree, at the moment. I found and fixed this bug in git-history, I should replicate that fix (and accompanying documentation) here: https://github.com/simonw/git-history/issues/39

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/351/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
1025726600 PR_kwDOCGYnMM4tKxHD 330 Test against Python 3.10 simonw 9599 closed 0     1 2021-10-13T21:50:22Z 2021-11-15T02:59:29Z 2021-10-13T22:25:05Z OWNER simonw/sqlite-utils/pulls/330   sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/330/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
979627285 MDU6SXNzdWU5Nzk2MjcyODU= 323 `table.convert()` method should clean up after itself simonw 9599 closed 0     1 2021-08-25T21:15:39Z 2021-08-25T21:25:26Z 2021-08-25T21:25:18Z OWNER  

It currently works like this: https://github.com/simonw/sqlite-utils/blob/77c240df56068341561e95e4a412cbfa24dc5bc7/sqlite_utils/db.py#L2177-L2195

It's registering a function called convert_value() and then failing to de-register that function once it has finished.

It might even be possible for two queries running against the same connection to clobber each other's convert_value() functions, leading to incorrect behaviour.

So two fixes: firstly it should register the function with a unique name (maybe add a random suffix). Secondly, it should de-register that function once it has finished.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/323/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
972827346 MDU6SXNzdWU5NzI4MjczNDY= 317 Link to a better example on docs index simonw 9599 closed 0     1 2021-08-17T15:43:40Z 2021-08-18T18:31:43Z 2021-08-18T18:31:43Z OWNER  

https://github.com/simonw/sqlite-utils/blob/7a19822ac9ee24be2fbb4c2326a0bf2f3d2d9c4d/docs/index.rst#L39 Is a very old example

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/317/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
970320615 MDU6SXNzdWU5NzAzMjA2MTU= 316 Fix visible backticks on reference page simonw 9599 closed 0     1 2021-08-13T11:37:46Z 2021-08-14T05:12:23Z 2021-08-14T05:10:48Z OWNER  

https://sqlite-utils.datasette.io/en/latest/reference.html

Search for backtick to reveal various minor markup bugs.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/316/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
965440017 MDU6SXNzdWU5NjU0NDAwMTc= 315 `.delete_where()` returns `[]` when it should return self simonw 9599 closed 0     1 2021-08-10T21:54:55Z 2021-08-10T23:09:29Z 2021-08-10T23:09:29Z OWNER  

If the table doesn't exist it should still return self, not []:

https://github.com/simonw/sqlite-utils/blob/ee469e3122d6f5973ec2584c1580d930daca2e7c/sqlite_utils/db.py#L1676-L1683

Spotted with mypy while working on #312.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/315/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
957741820 MDU6SXNzdWU5NTc3NDE4MjA= 305 Python: need a way to execute a count with an extra where clause simonw 9599 closed 0     1 2021-08-02T04:52:02Z 2021-08-02T05:08:22Z 2021-08-02T05:08:22Z OWNER  

I need this for #304. I'll probably add this to the .execute_count() method as where= and where_args=.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/305/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
957536983 MDExOlB1bGxSZXF1ZXN0NzAwOTQ0NjQ0 303 sqlite-utils convert command and db[table].convert(...) method simonw 9599 closed 0     1 2021-08-01T16:52:42Z 2021-08-02T04:47:42Z 2021-08-02T04:47:39Z OWNER simonw/sqlite-utils/pulls/303

Refs #251, #302.

  • [x] Get recipes working
  • [x] Document recipes
  • [x] Implement db[table].convert(...) method
  • [x] Add tests for recipes that use the new Python method
  • [x] Implement db[table].convert(..., multi=True) mechanism
  • [x] Documentation for db[table].convert(...)
  • [x] Refactor sqlite-utils convert to use the new method
sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/303/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
957529248 MDU6SXNzdWU5NTc1MjkyNDg= 302 Python library version of `sqlite-utils convert` simonw 9599 closed 0 simonw 9599   1 2021-08-01T16:11:02Z 2021-08-02T04:47:40Z 2021-08-02T04:47:40Z OWNER  

Spin off from #251. The ability to execute Python functions to convert and split columns should be part of the library too, not just the CLI.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/302/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
952154468 MDU6SXNzdWU5NTIxNTQ0Njg= 299 Ability to see just specific table schemas with `sqlite-utils schema` simonw 9599 closed 0     1 2021-07-24T22:00:05Z 2021-07-24T22:12:01Z 2021-07-24T22:08:46Z OWNER  

It currently accepts no arguments. Allowing for optional arguments specifying tables would be useful:

sqlite-utils schema fixtures.db facetable searchable
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/299/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
925487946 MDU6SXNzdWU5MjU0ODc5NDY= 286 Add installation instructions simonw 9599 closed 0     1 2021-06-19T23:55:36Z 2021-06-20T18:47:13Z 2021-06-20T18:47:13Z OWNER  

pip install sqlite-utils, pipx install sqlite-utils and brew install sqlite-utils

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/286/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
925319214 MDU6SXNzdWU5MjUzMTkyMTQ= 283 memory: Shouldn't detect types for JSON simonw 9599 closed 0     1 2021-06-19T05:17:35Z 2021-06-19T14:52:48Z 2021-06-19T14:52:48Z OWNER  

https://github.com/simonw/sqlite-utils/blob/ec5174ed40fa283cb06f25ee0c0136297ec313ae/sqlite_utils/cli.py#L1244-L1251

This runs against JSON as well as CSV/TSV - which isn't necessary and In fact throws errors if there is any nested data.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/283/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
924992318 MDU6SXNzdWU5MjQ5OTIzMTg= 281 Mechanism for explicitly stating CSV or JSON or TSV for sqlite-utils memory simonw 9599 closed 0     1 2021-06-18T15:04:53Z 2021-06-19T03:11:59Z 2021-06-19T03:11:59Z OWNER  
  • Implement filename.json:json and -:nl and suchlike options for specifying the format rather than guessing it - see https://github.com/simonw/sqlite-utils/issues/272#issuecomment-861985944

Follows #272

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/281/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
922955697 MDU6SXNzdWU5MjI5NTU2OTc= 275 Enable code coverage simonw 9599 closed 0     1 2021-06-16T18:33:49Z 2021-06-17T00:12:12Z 2021-06-17T00:12:12Z OWNER  

https://app.codecov.io/gh/simonw/sqlite-utils

Same mechanism as Datasette. Need to copy across the token from that page and add an equivalent of this workflow: https://github.com/simonw/datasette/blob/main/.github/workflows/test-coverage.yml

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/275/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
919702451 MDU6SXNzdWU5MTk3MDI0NTE= 271 table.upsert_all() fails if input has a single column that should be a primary key simonw 9599 closed 0     1 2021-06-13T02:50:27Z 2021-06-13T02:57:29Z 2021-06-13T02:57:29Z OWNER  

This works: ```pycon

db['foo'].insert_all([{"name": "hello"}], pk="name")

<Table foo (name)> ``` But this fails: ``` >>> db['foo3'].upsert_all([{"name": "hello"}], pk="name") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1837, in upsert_all return self.insert_all( File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1778, in insert_all self.insert_chunk( File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1588, in insert_chunk result = self.db.execute(query, params) File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 213, in execute return self.conn.execute(sql, parameters) sqlite3.OperationalError: near "WHERE": syntax error ``` With the debugger: ``` >>> import pdb; pdb.pm() > /Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py(213)execute() -> return self.conn.execute(sql, parameters) (Pdb) print(sql, parameters) UPDATE [foo3] SET WHERE [name] = ? ['hello'] ```
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/271/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
894948100 MDU6SXNzdWU4OTQ5NDgxMDA= 259 Suggest the --alter option if a new column cannot be added simonw 9599 closed 0     1 2021-05-19T03:17:38Z 2021-05-19T03:27:33Z 2021-05-19T03:26:26Z OWNER  

Refs #256.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/259/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
816523763 MDU6SXNzdWU4MTY1MjM3NjM= 238 .add_foreign_key() corrupts database if column contains a space simonw 9599 closed 0     1 2021-02-25T15:07:20Z 2021-02-25T16:54:02Z 2021-02-25T16:54:02Z OWNER  

I ran this:

db["Reports"].add_foreign_key("Reported by ID", "Reporters", "id")

And got this:

``` ~/jupyter-venv/lib/python3.9/site-packages/sqlite_utils/db.py in add_foreign_keys(self, foreign_keys) 616 # Have to VACUUM outside the transaction to ensure .foreign_keys property 617 # can see the newly created foreign key. --> 618 self.vacuum() 619 620 def index_foreign_keys(self):

~/jupyter-venv/lib/python3.9/site-packages/sqlite_utils/db.py in vacuum(self) 629 630 def vacuum(self): --> 631 self.execute("VACUUM;") 632 633

~/jupyter-venv/lib/python3.9/site-packages/sqlite_utils/db.py in execute(self, sql, parameters) 234 return self.conn.execute(sql, parameters) 235 else: --> 236 return self.conn.execute(sql) 237 238 def executescript(self, sql):

DatabaseError: database disk image is malformed ```

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/238/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
811680502 MDU6SXNzdWU4MTE2ODA1MDI= 236 --attach command line option for attaching extra databases simonw 9599 closed 0     1 2021-02-19T04:38:30Z 2021-02-19T05:10:41Z 2021-02-19T05:08:43Z OWNER  

This will enable cross-database joins, as seen in https://github.com/simonw/datasette/issues/283

Also refs #113

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/236/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
808046597 MDU6SXNzdWU4MDgwNDY1OTc= 234 .insert_all() fails if subsequent chunks contain additional columns simonw 9599 closed 0     1 2021-02-14T21:01:51Z 2021-02-14T21:03:40Z 2021-02-14T21:03:40Z OWNER  

Reported by @nieuwenhoven in #225 along with a proposed fix.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/234/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
777540352 MDU6SXNzdWU3Nzc1NDAzNTI= 216 database.triggers_dict introspection property simonw 9599 closed 0     1 2021-01-02T23:13:00Z 2021-01-03T04:27:14Z 2021-01-03T04:25:36Z OWNER  

Following #211

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/216/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
777560474 MDU6SXNzdWU3Nzc1NjA0NzQ= 218 "sqlite-utils triggers" command simonw 9599 closed 0     1 2021-01-03T02:34:50Z 2021-01-03T03:49:51Z 2021-01-03T03:03:35Z OWNER  

A command to list the triggers in the database.

sqlite-utils triggers my.db

Can optionally take one or more tables:

sqlite-utils triggers my.db table1 table2
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/218/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
777392020 MDU6SXNzdWU3NzczOTIwMjA= 212 Mechanism for maintaining cache of table counts using triggers simonw 9599 closed 0     1 2021-01-02T02:58:53Z 2021-01-02T21:40:27Z 2021-01-02T21:40:27Z OWNER  

Counting all of the rows in a large table is expensive - this is one of the main causes of performance problems in Datasette when running against large databases.

Carefully constructed SQL triggers could be used to maintain accurate cached counts for a table, by incrementing and decrementing a counter every time a row is inserted or deleted.

sqlite-utils already has a mechanism for creating triggers for FTS - the table.enable_fts(..., create_triggers=True) method. How about a similar mechanism for setting up triggers to maintain a count of table rows?

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/212/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
738128913 MDU6SXNzdWU3MzgxMjg5MTM= 201 .search(columns=) and sqlite-utils search -c ... bug simonw 9599 closed 0   3.0 6079500 1 2020-11-07T01:27:26Z 2020-11-08T16:54:15Z 2020-11-08T16:54:15Z OWNER  

Both table.search(columns=) and the sqlite-utils search -c option do not work as expected - they always return both the rowid and the rank columns even if those have not been requested.

This should be fixed before the 3.0 non-alpha release.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/201/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
738115165 MDU6SXNzdWU3MzgxMTUxNjU= 200 sqlite-utils rows -c option simonw 9599 closed 0   3.0 6079500 1 2020-11-07T00:22:12Z 2020-11-07T00:28:48Z 2020-11-07T00:28:47Z OWNER  

To let you specify the exact columns you want. Based on the -c option to sqlite-utils search in #192.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/200/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
737855731 MDU6SXNzdWU3Mzc4NTU3MzE= 199 @db.register_function(..., replace=False) to avoid double-registering custom functions simonw 9599 closed 0     1 2020-11-06T15:39:21Z 2020-11-06T18:30:44Z 2020-11-06T18:30:44Z OWNER  

I'd like a mechanism to optionally avoid registering a custom function if it has already been registered.

SQLite doesn't seem to offer a way to introspect registered custom functions so I'll need to track what has already been registered in sqlite-utils instead.

Should I register the custom rank_bm25 SQLite function for every connection, or should I register it against the connection just the first time the user attempts an FTS4 search? I think I'd rather register it only if it is needed.

Originally posted by @simonw in https://github.com/simonw/sqlite-utils/issues/198#issuecomment-723145383

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/199/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
709861194 MDU6SXNzdWU3MDk4NjExOTQ= 180 Try running some tests using Hypothesis simonw 9599 closed 0     1 2020-09-28T01:11:30Z 2020-10-19T04:51:55Z 2020-10-19T04:51:55Z OWNER  

Inspired by this Twitter conversation: https://twitter.com/simonw/status/1310386009465479168

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/180/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
683830416 MDU6SXNzdWU2ODM4MzA0MTY= 137 --load-extension for other sqlite-utils commands simonw 9599 closed 0     1 2020-08-21T21:12:56Z 2020-10-16T19:14:32Z 2020-10-16T19:14:32Z OWNER  

e.g. for this: calands-datasette % sqlite-utils tables calands.db --counts [{"table": "spatial_ref_sys", "count": 4924}, {"table": "spatialite_history", "count": 14}, {"table": "sqlite_sequence", "count": 1}, {"table": "geometry_columns", "count": 2}, {"table": "spatial_ref_sys_aux", "count": 4873}, {"table": "views_geometry_columns", "count": 0}, {"table": "virts_geometry_columns", "count": 0}, {"table": "geometry_columns_statistics", "count": 2}, {"table": "views_geometry_columns_statistics", "count": 0}, {"table": "virts_geometry_columns_statistics", "count": 0}, {"table": "geometry_columns_field_infos", "count": 0}, {"table": "views_geometry_columns_field_infos", "count": 0}, {"table": "virts_geometry_columns_field_infos", "count": 0}, {"table": "geometry_columns_time", "count": 2}, {"table": "geometry_columns_auth", "count": 2}, {"table": "views_geometry_columns_auth", "count": 0}, {"table": "virts_geometry_columns_auth", "count": 0}, Traceback (most recent call last): File "/usr/local/bin/sqlite-utils", line 8, in <module> sys.exit(cli()) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/sqlite_utils/cli.py", line 143, in tables for line in output_rows(_iter(), headers, nl, arrays, json_cols): File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/sqlite_utils/cli.py", line 922, in output_rows for row, next_row in itertools.zip_longest(current_iter, next_iter): File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/sqlite_utils/cli.py", line 123, in _iter row.append(db[name].count) File "/usr/local/Cellar/sqlite-utils/2.15.1/libexec/lib/python3.8/site-packages/sqlite_utils/db.py", line 458, in count return self.db.conn.execute( sqlite3.OperationalError: no such module: VirtualSpatialIndex The tables command could take --load-extension too - as could rows and other similar commands.

Follow-on from #134

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/137/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
709920027 MDU6SXNzdWU3MDk5MjAwMjc= 181 pk=["id"] should have same effect as pk="id" simonw 9599 closed 0     1 2020-09-28T04:28:07Z 2020-10-14T21:59:47Z 2020-10-14T21:59:47Z OWNER  

``` In [11]: db['one'].insert({"id": 1, "name": "oentuh"}, pk="id") Out[11]: <Table one (id, name)>

In [12]: db['two'].insert({"id": 1, "name": "oentuh"}, pk=["id"]) Out[12]: <Table two (id, name)>

In [13]: db['one'].schema Out[13]: 'CREATE TABLE [one] (\n [id] INTEGER PRIMARY KEY,\n [name] TEXT\n)'

In [14]: db['two'].schema Out[14]: 'CREATE TABLE [two] (\n [id] INTEGER,\n [name] TEXT\n)' ```

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/181/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
712316959 MDU6SXNzdWU3MTIzMTY5NTk= 183 Try out GitHub code scanning simonw 9599 closed 0     1 2020-09-30T22:16:14Z 2020-09-30T22:23:44Z 2020-09-30T22:23:44Z OWNER  

https://github.blog/2020-09-30-code-scanning-is-now-available/

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/183/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
705190723 MDU6SXNzdWU3MDUxOTA3MjM= 160 table.enable_fts(..., replace=True) simonw 9599 closed 0   2.19 5896742 1 2020-09-20T21:36:23Z 2020-09-24T20:35:47Z 2020-09-20T22:05:51Z OWNER  

I noticed that https://til.simonwillison.net/ search doesn't use porter stemming. I'd like to add that, but since the build script always operates on an existing database (to avoid re-rendering markdown and re-building image thumbnails) I'd like it to only add porter stemming if it's not there already.

So I'd like to be able to say "set up FTS to look like this, and fix it if it doesn't".

I think the neatest way to do that is with a replace=True argument to .enable_fts(), for consistency with def .create_view(self, name, sql, replace=True).

So the replace=True argument would check and see if the configured FTS exists already with the correct options (columns, stemming, triggers) - and if any of those are incorrect it would call .disable_fts() and then create a new FTS configuration with the correct options.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/160/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
708301810 MDU6SXNzdWU3MDgzMDE4MTA= 177 Simplify .transform(drop_foreign_keys=) and sqlite-transform --drop-foreign-key simonw 9599 closed 0     1 2020-09-24T16:13:50Z 2020-09-24T20:35:03Z 2020-09-24T16:19:13Z OWNER  

These both currently require you to provide three strings, for column, other_table, other_column.

Just providing column should be enough information.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/177/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
706768798 MDU6SXNzdWU3MDY3Njg3OTg= 170 Release notes for 2.20 simonw 9599 closed 0   2.20 5897911 1 2020-09-23T00:13:22Z 2020-09-23T00:31:25Z 2020-09-23T00:31:25Z OWNER  

https://github.com/simonw/sqlite-utils/compare/2.19...b8e004

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/170/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
706098005 MDU6SXNzdWU3MDYwOTgwMDU= 167 Review the foreign key pragma stuff simonw 9599 closed 0   2.20 5897911 1 2020-09-22T05:55:20Z 2020-09-23T00:13:02Z 2020-09-23T00:13:02Z OWNER  

It is not possible to enable or disable foreign key constraints in the middle of a multi-statement transaction (when SQLite is not in autocommit mode). Attempting to do so does not return an error; it simply has no effect.

https://sqlite.org/foreignkeys.html

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/167/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
531583658 MDU6SXNzdWU1MzE1ODM2NTg= 68 Add support for porter stemming in FTS simonw 9599 closed 0     1 2019-12-02T22:35:52Z 2020-09-20T04:25:53Z 2020-09-20T04:25:47Z OWNER  

FTS5 can have porter stemming enabled.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/68/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
695276328 MDU6SXNzdWU2OTUyNzYzMjg= 148 More attractive indentation of created FTS table schema simonw 9599 closed 0     1 2020-09-07T16:49:30Z 2020-09-07T18:12:50Z 2020-09-07T18:12:50Z OWNER  

On https://github-to-sqlite.dogsheep.net/github/licenses_fts the create table SQL is displayed as: sql CREATE VIRTUAL TABLE [licenses_fts] USING FTS5 ( [name], content=[licenses] ); It would be more aesthetically pleasing if it looked like this: sql CREATE VIRTUAL TABLE [licenses_fts] USING FTS5 ( [name], content=[licenses] );

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/148/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
688389933 MDU6SXNzdWU2ODgzODk5MzM= 143 Move to GitHub Actions CI simonw 9599 closed 0     1 2020-08-28T22:34:11Z 2020-08-28T22:41:35Z 2020-08-28T22:41:35Z OWNER  
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/143/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
677839979 MDU6SXNzdWU2Nzc4Mzk5Nzk= 133 Release a sdist to PyPI simonw 9599 closed 0     1 2020-08-12T16:55:09Z 2020-08-12T17:05:06Z 2020-08-12T17:05:06Z OWNER  

https://pypi.org/project/sqlite-utils/#files currently just has a wheel. I need this to package for homebrew: https://github.com/simonw/homebrew-datasette/issues/10

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/133/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
665802405 MDU6SXNzdWU2NjU4MDI0MDU= 124 sqlite-utils query should support named parameters simonw 9599 closed 0     1 2020-07-26T15:25:10Z 2020-07-30T22:57:51Z 2020-07-27T03:53:58Z OWNER  

To help out with escaping - so you can run this:

sqlite-utils query "insert into foo (blah) values (:blah)" --param blah `something here`
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/124/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
666639051 MDU6SXNzdWU2NjY2MzkwNTE= 128 Support UUID and memoryview types simonw 9599 closed 0     1 2020-07-27T23:08:34Z 2020-07-30T01:10:43Z 2020-07-30T01:10:43Z OWNER  

psycopg2 can return data from PostgreSQL as uuid.UUID or memoryview objects. These should to be supported by sqlite-utils - mainly for https://github.com/simonw/db-to-sqlite

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/128/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
637889964 MDU6SXNzdWU2Mzc4ODk5NjQ= 115 Ability to execute insert/update statements with the CLI simonw 9599 closed 0     1 2020-06-12T17:01:17Z 2020-06-12T17:51:11Z 2020-06-12T17:41:10Z OWNER  

$ sqlite-utils github.db "update stars set starred_at = ''" Traceback (most recent call last): File "/Users/simon/.local/bin/sqlite-utils", line 8, in <module> sys.exit(cli()) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/simon/.local/pipx/venvs/sqlite-utils/lib/python3.8/site-packages/sqlite_utils/cli.py", line 673, in query headers = [c[0] for c in cursor.description] TypeError: 'NoneType' object is not iterable

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/115/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
461215118 MDU6SXNzdWU0NjEyMTUxMTg= 30 Option to open database in read-only mode simonw 9599 closed 0     1 2019-06-26T22:50:38Z 2020-05-11T19:17:17Z 2020-05-11T19:17:17Z OWNER  

Would this make it 100% safe to run reads against a database file that is being written to by another process?

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/30/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
612658444 MDU6SXNzdWU2MTI2NTg0NDQ= 109 table.create_index(..., ignore=True) simonw 9599 closed 0     1 2020-05-05T14:44:21Z 2020-05-05T14:46:53Z 2020-05-05T14:46:53Z OWNER  

Option to silently do nothing if the index already exists.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/109/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
611216862 MDU6SXNzdWU2MTEyMTY4NjI= 106 create_view(..., ignore=True, replace=True) parameters simonw 9599 closed 0     1 2020-05-02T15:45:21Z 2020-05-02T16:04:51Z 2020-05-02T16:02:10Z OWNER  

Two new parameters which specify what should happen if the view already exists. I want this for https://github.com/dogsheep/github-to-sqlite/issues/37

Here's the current create_view() implementation:

https://github.com/simonw/sqlite-utils/blob/b4d953d3ccef28bb81cea40ca165a647b59971fa/sqlite_utils/db.py#L325-L332

ignore=True will not do anything if the view exists already.

replace=True will drop and redefine the view - but only if its SQL definition differs, otherwise it will be left alone.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/106/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
610853576 MDU6SXNzdWU2MTA4NTM1NzY= 105 "sqlite-utils views" command simonw 9599 closed 0     1 2020-05-01T16:56:11Z 2020-05-01T20:40:07Z 2020-05-01T20:38:36Z OWNER  

Similar to sqlite-utils tables. See also #104.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/105/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
562911863 MDU6SXNzdWU1NjI5MTE4NjM= 85 Create index doesn't work for columns containing spaces simonw 9599 closed 0     1 2020-02-11T00:34:46Z 2020-02-11T05:13:20Z 2020-02-11T05:13:20Z OWNER  
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/85/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
559374410 MDU6SXNzdWU1NTkzNzQ0MTA= 83 Make db["table"].exists a documented API simonw 9599 closed 0     1 2020-02-03T22:31:44Z 2020-02-08T23:58:35Z 2020-02-08T23:56:23Z OWNER  

Right now it's a static thing which might get out-of-sync with the database. It should probably be a live check. Maybe call it .exists() instead?

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/83/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
476413293 MDU6SXNzdWU0NzY0MTMyOTM= 52 Throws error if .insert_all() / .upsert_all() called with empty list simonw 9599 closed 0     1 2019-08-03T04:09:00Z 2019-11-07T04:32:39Z 2019-11-07T04:32:39Z OWNER  

See also https://github.com/simonw/db-to-sqlite/issues/18

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/52/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
517241040 MDU6SXNzdWU1MTcyNDEwNDA= 63 ensure_index() method simonw 9599 closed 0     1 2019-11-04T15:51:22Z 2019-11-04T16:20:36Z 2019-11-04T16:20:35Z OWNER  

python db["table"].ensure_index(["col1", "col2"])

This will do the following: - if the specified table or column does not exist, do nothing - if they exist and already have an index, do nothing - otherwise, create the index

I want this for tools like twitter-to-sqlite search where the search_runs table may or not have been created yet but, if it IS created, I want to put an index on the hash column.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/63/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
481887482 MDExOlB1bGxSZXF1ZXN0MzA4MjkyNDQ3 55 Ability to introspect and run queries against views simonw 9599 closed 0     1 2019-08-17T13:40:56Z 2019-08-23T12:19:42Z 2019-08-23T12:19:42Z OWNER simonw/sqlite-utils/pulls/55

See #54

sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/55/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
473733752 MDExOlB1bGxSZXF1ZXN0MzAxODI0MDk3 51 Fix for too many SQL variables, closes #50 simonw 9599 closed 0     1 2019-07-28T11:30:30Z 2019-07-28T11:59:32Z 2019-07-28T11:59:32Z OWNER simonw/sqlite-utils/pulls/51
sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/51/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
351845423 MDU6SXNzdWUzNTE4NDU0MjM= 3 Experiment with contentless FTS tables simonw 9599 closed 0     1 2018-08-18T19:31:01Z 2019-07-22T20:58:55Z 2019-07-22T20:58:55Z OWNER  

Could greatly reduce size of resulting database for large datasets: http://cocoamine.net/blog/2015/09/07/contentless-fts4-for-large-immutable-documents/

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/3/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
467928674 MDExOlB1bGxSZXF1ZXN0Mjk3NDU5Nzk3 40 .get() method plus support for compound primary keys simonw 9599 closed 0     1 2019-07-15T03:43:13Z 2019-07-15T04:28:57Z 2019-07-15T04:28:52Z OWNER simonw/sqlite-utils/pulls/40
  • [x] Tests for the NotFoundError exception
  • [x] Documentation for .get() method
  • [x] Support --pk multiple times to define CLI compound primary keys
  • [x] Documentation for compound primary keys
sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/40/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
455996809 MDU6SXNzdWU0NTU5OTY4MDk= 28 Rearrange the docs by area, not CLI vs Python simonw 9599 closed 0     1 2019-06-13T23:33:35Z 2019-07-15T02:37:20Z 2019-07-15T02:37:20Z OWNER  

The docs for eg inserting data should live on the same page, rather than being split across the API and CLI pages.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/28/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
462094937 MDExOlB1bGxSZXF1ZXN0MjkyODc5MjA0 32 db.add_foreign_keys() method simonw 9599 closed 0     1 2019-06-28T15:40:33Z 2019-06-29T06:27:39Z 2019-06-29T06:27:39Z OWNER simonw/sqlite-utils/pulls/32

Refs #31. Still TODO:

  • [x] Unit tests
  • [x] Documentation
sqlite-utils 140912432 pull    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/32/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
0  
349850687 MDU6SXNzdWUzNDk4NTA2ODc= 2 Mechanism for adding foreign keys to an existing table simonw 9599 closed 0     1 2018-08-12T22:50:56Z 2019-02-24T21:34:41Z 2019-02-24T21:34:41Z OWNER  

SQLite does not have ALTER TABLE support for adding new foreign keys... but it turns out it's possible to make these changes without having to duplicate the entire table by carefully running UPDATE sqlite_master SET sql=... WHERE type='table' AND name='X';

Here's how Django does it: https://github.com/django/django/blob/d3449faaa915a08c275b35de01e66a7ef6bdb2dc/django/db/backends/sqlite3/schema.py#L103-L125

And here's the official documentation about this: https://sqlite.org/lang_altertable.html#otheralter (scroll to the very bottom of the page)

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/2/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
413779210 MDU6SXNzdWU0MTM3NzkyMTA= 13 Ability to automatically create IDs from content hash of row simonw 9599 closed 0     1 2019-02-24T04:07:08Z 2019-02-24T04:36:48Z 2019-02-24T04:36:48Z OWNER  

Sometimes when you are importing data the underlying source provides records without IDs that can be uniquely identified by their contents.

A utility mechanism for calculating a sha1 hash of the contents and using that as a unique ID would be useful.

sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/13/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed
403624090 MDU6SXNzdWU0MDM2MjQwOTA= 6 "sqlite-utils insert" should support newline-delimited JSON simonw 9599 closed 0     1 2019-01-28T02:00:02Z 2019-01-28T02:17:45Z 2019-01-28T02:17:45Z OWNER  

We can already export newline delimited JSON. We should learn to import it as well.

The neat thing about importing it is that you can import GBs of data without having to read the whole lot into memory in order to decode the wrapping JSON array.

Datasette can export it now: https://github.com/simonw/datasette/issues/405

Demo: https://latest.datasette.io/fixtures/facetable.json?_shape=array&_nl=on

It should be possible to do this:

$ curl "https://latest.datasette.io/fixtures/facetable.json?_shape=array&_nl=on" \
    | sqlite-utils insert data.db facetable - --nl
sqlite-utils 140912432 issue    
{
    "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/6/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [pull_request] TEXT,
   [body] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
, [active_lock_reason] TEXT, [performed_via_github_app] TEXT, [reactions] TEXT, [draft] INTEGER, [state_reason] TEXT);
CREATE INDEX [idx_issues_repo]
                ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
                ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
                ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
                ON [issues] ([user]);
Powered by Datasette · Queries took 487.671ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows