Repository Analysis

simonw/sqlite-utils

Python CLI utility and library for manipulating SQLite databases

17.6 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of simonw/sqlite-utils, a Python project with 2,122 GitHub stars. SynthScan v2.0 examined 26,290 lines of code across 81 source files, recording 541 pattern matches distributed across 11 syntactic categories. The overall adjusted score of 17.6 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

17.6
Adjusted Score
17.6
Raw Score
100%
Time Factor
2026-07-13
Last Push
2.1K
Stars
Python
Language
26.3K
Lines of Code
81
Files
541
Pattern Hits
2026-07-14
Scan Date
0.04
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 3MEDIUM 8LOW 530

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 541 distinct pattern matches across 11 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers459 hits · 372 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py306def _iter_complete_sql_statements(sql: str) -> Generator[str, None, None]:STRING
LOWsqlite_utils/db.py1188 def _ensure_no_open_transaction(self, operation: str) -> None:STRING
LOWsqlite_utils/db.py1347 def _resolve_foreign_key_casing(STRING
LOWsqlite_utils/db.py3971 def build_insert_queries_and_params(STRING
LOWsqlite_utils/cli.py1047def insert_upsert_implementation(STRING
LOWsqlite_utils/cli.py2943 def yield_paths_and_relative_paths():STRING
LOWsqlite_utils/cli.py3473def _compatible_migration_set(obj):CODE
LOWsqlite_utils/cli.py3512def _stop_before_for_migration_set(stop_before, migration_set_name):CODE
LOWsqlite_utils/cli.py3785def _maybe_register_functions(db, functions_list):CODE
LOWsqlite_utils/utils.py91def maximize_csv_field_size_limit() -> None:CODE
LOWtests/test_conversions.py7def test_insert_all_conversion(fresh_db):CODE
LOWtests/test_conversions.py23def test_upsert_all_conversion(fresh_db):CODE
LOWtests/test_conversions.py38def test_table_constructor_conversion(fresh_db):CODE
LOWtests/test_default_value.py41def test_insert_empty_record_uses_default_values(fresh_db):CODE
LOWtests/test_enable_counts.py7def test_enable_counts_specific_table(fresh_db):CODE
LOWtests/test_enable_counts.py59def test_enable_counts_all_tables(fresh_db):CODE
LOWtests/test_enable_counts.py128def test_uses_counts_after_enable_counts(counts_db_path):CODE
LOWtests/test_utils.py56def test_maximize_csv_field_size_limit():CODE
LOWtests/test_transform.py104def test_transform_sql_table_with_primary_key(CODE
LOWtests/test_transform.py177def test_transform_sql_table_with_no_primary_key(CODE
LOWtests/test_transform.py204def test_transform_sql_with_no_primary_key_to_primary_key_of_id(fresh_db):CODE
LOWtests/test_transform.py229def test_transform_preserves_keyword_literal_defaults(fresh_db):CODE
LOWtests/test_transform.py273def test_transform_remove_a_not_null(fresh_db):CODE
LOWtests/test_transform.py284def test_transform_add_not_null_with_rename(fresh_db, not_null):CODE
LOWtests/test_transform.py304def test_transform_defaults_and_rename_column(fresh_db):CODE
LOWtests/test_transform.py337def test_transform_foreign_keys_persist(authors_db):CODE
LOWtests/test_transform.py352def test_transform_foreign_keys_survive_renamed_column(CODE
LOWtests/test_transform.py368def _add_country_city_continent(db):CODE
LOWtests/test_transform.py384def test_transform_drop_foreign_keys(fresh_db, use_pragma_foreign_keys):CODE
LOWtests/test_transform.py417def test_transform_verify_foreign_keys(fresh_db):CODE
LOWtests/test_transform.py436def test_transform_on_delete_cascade_does_not_delete_records(CODE
LOWtests/test_transform.py473def test_transform_in_transaction_refuses_destructive_on_delete(fresh_db, on_delete):STRING
LOWtests/test_transform.py504def test_transform_in_transaction_refuses_self_referential_cascade(fresh_db):STRING
LOWtests/test_transform.py528def test_transform_in_transaction_allowed_with_no_action_foreign_key(fresh_db):STRING
LOWtests/test_transform.py553def test_transform_in_transaction_allowed_for_child_table(fresh_db):STRING
LOWtests/test_transform.py574def test_transform_in_transaction_allowed_with_foreign_keys_off(fresh_db):STRING
LOWtests/test_transform.py594def test_transform_add_foreign_keys_from_scratch(fresh_db):STRING
LOWtests/test_transform.py638def test_transform_add_foreign_keys_from_partial(fresh_db, add_foreign_keys):STRING
LOWtests/test_transform.py678def test_transform_replace_foreign_keys(fresh_db, foreign_keys):STRING
LOWtests/test_transform.py699def test_transform_preserves_rowids(fresh_db, table_type):STRING
LOWtests/test_transform.py749def test_transform_to_strict_with_invalid_data(fresh_db):STRING
LOWtests/test_transform.py764def test_transform_strict_updates_default(fresh_db):STRING
LOWtests/test_transform.py778def test_transform_to_strict_not_supported(fresh_db, method_name):STRING
LOWtests/test_transform.py831def test_transform_retains_indexes_with_foreign_keys(fresh_db):STRING
LOWtests/test_transform.py866def test_transform_with_indexes_errors(fresh_db, transform_params):STRING
LOWtests/test_transform.py883def test_transform_with_unique_constraint_implicit_index(fresh_db):STRING
LOWtests/test_duplicate.py39def test_duplicate_fails_if_table_does_not_exist(fresh_db):CODE
LOWtests/test_plugins.py9def _supports_pragma_function_list():CODE
LOWtests/test_plugins.py20def test_get_plugins_loads_setuptools_entrypoints_once(monkeypatch):CODE
LOWtests/test_plugins.py36def test_get_plugins_does_not_load_setuptools_entrypoints_in_tests(monkeypatch):CODE
LOWtests/test_wal.py27def test_enable_wal_inside_transaction_raises(db_path_tmpdir):CODE
LOWtests/test_wal.py40def test_disable_wal_inside_transaction_raises(db_path_tmpdir):CODE
LOWtests/test_wal.py52def test_ensure_autocommit_on(db_path_tmpdir):CODE
LOWtests/test_wal.py63def test_enable_wal_noop_inside_transaction_is_allowed(db_path_tmpdir):CODE
LOWtests/test_wal.py74def test_ensure_autocommit_on_inside_transaction_raises(db_path_tmpdir):CODE
LOWtests/test_extracts.py72def test_extracts_null_values(fresh_db):CODE
LOWtests/test_extracts.py96def test_extracts_null_values_list_mode(fresh_db):CODE
LOWtests/test_cli_migrate.py33def two_sets_same_migration_name(tmpdir):STRING
LOWtests/test_cli_migrate.py110def test_list_same_migration_names_in_different_sets(capsys):STRING
LOWtests/test_cli_migrate.py230def test_stop_before_multiple_sets_unqualified(two_migrations):STRING
399 more matches not shown…
Deep Nesting24 hits · 21 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py452CODE
LOWsqlite_utils/db.py5188CODE
LOWsqlite_utils/db.py513CODE
LOWsqlite_utils/db.py1248CODE
LOWsqlite_utils/db.py1717CODE
LOWsqlite_utils/db.py2503CODE
LOWsqlite_utils/db.py2633CODE
LOWsqlite_utils/db.py2917CODE
LOWsqlite_utils/db.py3053CODE
LOWsqlite_utils/db.py3924CODE
LOWsqlite_utils/db.py3971CODE
LOWsqlite_utils/db.py4188CODE
LOWsqlite_utils/db.py4341CODE
LOWsqlite_utils/db.py4978CODE
LOWsqlite_utils/db.py2725CODE
LOWsqlite_utils/cli.py1047CODE
LOWsqlite_utils/cli.py2102CODE
LOWsqlite_utils/cli.py2260CODE
LOWsqlite_utils/cli.py2905CODE
LOWsqlite_utils/cli.py3748CODE
LOWsqlite_utils/cli.py2943CODE
LOWsqlite_utils/utils.py144CODE
LOWsqlite_utils/utils.py265CODE
LOWsqlite_utils/utils.py292CODE
Excessive Try-Catch Wrapping14 hits · 13 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py916 except Exception:STRING
LOWsqlite_utils/db.py1117 except Exception:STRING
LOWsqlite_utils/db.py1143 except Exception:STRING
LOWsqlite_utils/cli.py70 except Exception:CODE
LOWsqlite_utils/cli.py1134 except Exception as e:STRING
LOWsqlite_utils/cli.py3322 except Exception as ex:STRING
MEDIUMsqlite_utils/cli.py3319def wrapped_fn(value):CODE
LOWsqlite_utils/utils.py545 except Exception:CODE
LOWtests/conftest.py58 except Exception:CODE
LOWtests/test_plugins.py14 except Exception:CODE
LOWtests/test_cli.py24 except Exception:CODE
LOWdocs/conf.py53 except Exception:CODE
LOWdocs/conf.py82 except Exception:CODE
MEDIUMdocs/conf.py50def _linkcode_git_ref():CODE
Cross-Language Confusion3 hits · 12 pts
SeverityFileLineSnippetContext
HIGHsqlite_utils/db.py1034 # default into a string ('TRUE' instead of 1, 'NULL' instead of null).STRING
HIGHsqlite_utils/db.py5034 # Optimization - if all rows are null, don't run this querySTRING
HIGHtests/test_extracts.py74 # Null values should stay null, not be extracted into the lookup tableCOMMENT
Self-Referential Comments6 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMsqlite_utils/db.py490 # Create an in-memory database:COMMENT
MEDIUMsqlite_utils/db.py2069 # This method is defined on Queryable so it serves views too, whichSTRING
MEDIUMtests/test_transform.py885 # Create a table with a UNIQUE constraint on 'name', which creates an implicit indexSTRING
MEDIUMtests/test_cli.py913 # Create a temporary file with function definitionsSTRING
MEDIUMtests/test_m2m.py164 # Create a candidateCOMMENT
MEDIUMdocs/conf.py9# This file is execfile()d with the current directory set to itsCOMMENT
AI Structural Patterns14 hits · 11 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py513CODE
LOWsqlite_utils/db.py1389CODE
LOWsqlite_utils/db.py1566CODE
LOWsqlite_utils/db.py2153CODE
LOWsqlite_utils/db.py2397CODE
LOWsqlite_utils/db.py2503CODE
LOWsqlite_utils/db.py2633CODE
LOWsqlite_utils/db.py3685CODE
LOWsqlite_utils/db.py4272CODE
LOWsqlite_utils/db.py4341CODE
LOWsqlite_utils/db.py4701CODE
LOWsqlite_utils/db.py4739CODE
LOWsqlite_utils/db.py4790CODE
LOWsqlite_utils/cli.py1047CODE
Unused Imports10 hits · 10 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/__init__.py1CODE
LOWsqlite_utils/__init__.py2CODE
LOWsqlite_utils/__init__.py3CODE
LOWsqlite_utils/__init__.py4CODE
LOWsqlite_utils/__init__.py5CODE
LOWsqlite_utils/recipes.py1CODE
LOWsqlite_utils/migrations.py7CODE
LOWsqlite_utils/migrations.py7CODE
LOWtests/test_register_function.py2CODE
LOWtests/test_register_function.py3CODE
Over-Commented Block6 hits · 6 pts
SeverityFileLineSnippetContext
LOWdocs/conf.py1#!/usr/bin/env python3COMMENT
LOWdocs/conf.py21#COMMENT
LOWdocs/conf.py101COMMENT
LOWdocs/conf.py161# Theme options are theme-specific and customize the look and feel of a themeCOMMENT
LOWdocs/conf.py181COMMENT
LOW.github/workflows/codeql-analysis.yml41 # If you wish to specify custom queries, you can do so here or in a config file.COMMENT
Redundant / Tautological Comments3 hits · 3 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py4455 # Check if this is list mode or dict modeSTRING
LOWsqlite_utils/cli.py3766 # Check if this is a file pathCOMMENT
LOWsqlite_utils/utils.py539 # Check if code is a direct callable referenceCOMMENT
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/__init__.py7__all__ = ["Database", "Migrations", "suggest_column_types", "hookimpl", "hookspec"]CODE
AI Slop Vocabulary1 hit · 0 pts
SeverityFileLineSnippetContext
LOWsqlite_utils/db.py5053 # No need to run the query if it will just return the results in reverse orderSTRING