simonw / simonw/sqlite-utils

Feature request: trim all leading and trailing white space for all columns for all tables in a database

Open
#523 1 comment 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

It's pretty common that i need to trim leading or trailing white space from lots of columns in a database a part of an initial ETL.

I use the following recipe a lot, and it would be great to include this functionality into sqlite-utils

trimify.sql

select 'select group_concat(''update [' || name || '] set ['' || name || ''] = trim(['' || name || ''])'', '';
'') || '';
'' as sql_to_run from pragma_table_info('''||name||''');' from sqlite_schema;

then something like:

	sqlite3 example.db < scripts/trimify.sql > table_trim.sql && \
             sqlite3 $example.db < table_trim.sql > trim.sql && \
             sqlite3 $example.db < trim.sql

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

Start by reviewing the trimify.sql recipe and the sqlite3 command pipeline described in the issue, then inspect sqlite-utils' existing CLI and database-operation entry points. Done means sqlite-utils provides a defined way to trim leading and trailing whitespace across all columns in all tables, with behavior verified against the example database workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.