simonw / simonw/sqlite-utils

Single quoted transform recipes on Windows do not work as expected

Open
#459 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.2k
Forks
172
Avg merge
9m
Merged PRs (30d)
1

Description

Trying to follow the tutorial for sqlite-utils and datasette https://datasette.io/tutorials/clean-data on Windows 11 OS Microsoft Windows [Version 10.0.22622.440], with sqlite-utils and datasette installed using pipx.

pipx list
package datasette 0.61.1, installed using Python 3.10.4
    - datasette.exe
package sqlite-utils 3.28, installed using Python 3.10.4
    - sqlite-utils.exe

In the step to transform dates into ISO dates the quoted value 'r.parsedatetime(value)' is copied verbatim into the columns instead of applying the output of the Python recipe.

sqlite-utils convert manatees.db locations \
  REPDATE created_date last_edited_date \
  'r.parsedatetime(value)' --dry-run

1975/01/31 00:00:00+00
 --- becomes:
r.parsedatetime(value)

Would affect 13568 rows

However, if I change the code from single quotes to double quotes, it works as expected.

sqlite-utils convert manatees.db locations \
  REPDATE created_date last_edited_date \
  "r.parsedatetime(value)" --dry-run

1975/01/31 00:00:00+00
 --- becomes:
1975-01-31T00:00:00+00:00

Would affect 13568 rows

Specifying the transform code recipe should work with single quotes on Windows.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the documented sqlite-utils convert command on Windows 11, comparing the single-quoted and double-quoted recipe arguments shown in the report. Start at the convert CLI entry point and trace how the recipe argument is interpreted; done means the single-quoted r.parsedatetime(value) recipe is executed rather than copied into every column.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.