cldellow / datasette-ui-extras

Add editing UI and other power-user features to Datasette.
Apache License 2.0
12 stars 1 forks source link

omnisearch fails to redirect row if compound pkey is used #101

Closed cldellow closed 1 year ago

cldellow commented 1 year ago

eg:

CREATE TABLE cities(
  state text not null,
  name text not null,
  population int,
  primary key (state, name)
);

can't navigate to a city - looks like we assume the key is not composite. Instead, we need to use tilde encoding: https://docs.datasette.io/en/stable/internals.html#tilde-encoding

Indeed, the code even has a comment saying so: https://github.com/cldellow/datasette-ui-extras/blob/d43d2bbd6a4d45d439c30d7ca283879fd0383b61/datasette_ui_extras/omnisearch.py#L136-L137

cldellow commented 1 year ago

Relevant code in Datasette: https://github.com/simonw/datasette/blob/0b4a28691468b5c758df74fa1d72a823813c96bf/datasette/views/table.py#L937-L948