Python CLI utility and library for manipulating SQLite databases
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).
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.
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.
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.
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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 306 | def _iter_complete_sql_statements(sql: str) -> Generator[str, None, None]: | STRING |
| LOW | sqlite_utils/db.py | 1188 | def _ensure_no_open_transaction(self, operation: str) -> None: | STRING |
| LOW | sqlite_utils/db.py | 1347 | def _resolve_foreign_key_casing( | STRING |
| LOW | sqlite_utils/db.py | 3971 | def build_insert_queries_and_params( | STRING |
| LOW | sqlite_utils/cli.py | 1047 | def insert_upsert_implementation( | STRING |
| LOW | sqlite_utils/cli.py | 2943 | def yield_paths_and_relative_paths(): | STRING |
| LOW | sqlite_utils/cli.py | 3473 | def _compatible_migration_set(obj): | CODE |
| LOW | sqlite_utils/cli.py | 3512 | def _stop_before_for_migration_set(stop_before, migration_set_name): | CODE |
| LOW | sqlite_utils/cli.py | 3785 | def _maybe_register_functions(db, functions_list): | CODE |
| LOW | sqlite_utils/utils.py | 91 | def maximize_csv_field_size_limit() -> None: | CODE |
| LOW | tests/test_conversions.py | 7 | def test_insert_all_conversion(fresh_db): | CODE |
| LOW | tests/test_conversions.py | 23 | def test_upsert_all_conversion(fresh_db): | CODE |
| LOW | tests/test_conversions.py | 38 | def test_table_constructor_conversion(fresh_db): | CODE |
| LOW | tests/test_default_value.py | 41 | def test_insert_empty_record_uses_default_values(fresh_db): | CODE |
| LOW | tests/test_enable_counts.py | 7 | def test_enable_counts_specific_table(fresh_db): | CODE |
| LOW | tests/test_enable_counts.py | 59 | def test_enable_counts_all_tables(fresh_db): | CODE |
| LOW | tests/test_enable_counts.py | 128 | def test_uses_counts_after_enable_counts(counts_db_path): | CODE |
| LOW | tests/test_utils.py | 56 | def test_maximize_csv_field_size_limit(): | CODE |
| LOW | tests/test_transform.py | 104 | def test_transform_sql_table_with_primary_key( | CODE |
| LOW | tests/test_transform.py | 177 | def test_transform_sql_table_with_no_primary_key( | CODE |
| LOW | tests/test_transform.py | 204 | def test_transform_sql_with_no_primary_key_to_primary_key_of_id(fresh_db): | CODE |
| LOW | tests/test_transform.py | 229 | def test_transform_preserves_keyword_literal_defaults(fresh_db): | CODE |
| LOW | tests/test_transform.py | 273 | def test_transform_remove_a_not_null(fresh_db): | CODE |
| LOW | tests/test_transform.py | 284 | def test_transform_add_not_null_with_rename(fresh_db, not_null): | CODE |
| LOW | tests/test_transform.py | 304 | def test_transform_defaults_and_rename_column(fresh_db): | CODE |
| LOW | tests/test_transform.py | 337 | def test_transform_foreign_keys_persist(authors_db): | CODE |
| LOW | tests/test_transform.py | 352 | def test_transform_foreign_keys_survive_renamed_column( | CODE |
| LOW | tests/test_transform.py | 368 | def _add_country_city_continent(db): | CODE |
| LOW | tests/test_transform.py | 384 | def test_transform_drop_foreign_keys(fresh_db, use_pragma_foreign_keys): | CODE |
| LOW | tests/test_transform.py | 417 | def test_transform_verify_foreign_keys(fresh_db): | CODE |
| LOW | tests/test_transform.py | 436 | def test_transform_on_delete_cascade_does_not_delete_records( | CODE |
| LOW | tests/test_transform.py | 473 | def test_transform_in_transaction_refuses_destructive_on_delete(fresh_db, on_delete): | STRING |
| LOW | tests/test_transform.py | 504 | def test_transform_in_transaction_refuses_self_referential_cascade(fresh_db): | STRING |
| LOW | tests/test_transform.py | 528 | def test_transform_in_transaction_allowed_with_no_action_foreign_key(fresh_db): | STRING |
| LOW | tests/test_transform.py | 553 | def test_transform_in_transaction_allowed_for_child_table(fresh_db): | STRING |
| LOW | tests/test_transform.py | 574 | def test_transform_in_transaction_allowed_with_foreign_keys_off(fresh_db): | STRING |
| LOW | tests/test_transform.py | 594 | def test_transform_add_foreign_keys_from_scratch(fresh_db): | STRING |
| LOW | tests/test_transform.py | 638 | def test_transform_add_foreign_keys_from_partial(fresh_db, add_foreign_keys): | STRING |
| LOW | tests/test_transform.py | 678 | def test_transform_replace_foreign_keys(fresh_db, foreign_keys): | STRING |
| LOW | tests/test_transform.py | 699 | def test_transform_preserves_rowids(fresh_db, table_type): | STRING |
| LOW | tests/test_transform.py | 749 | def test_transform_to_strict_with_invalid_data(fresh_db): | STRING |
| LOW | tests/test_transform.py | 764 | def test_transform_strict_updates_default(fresh_db): | STRING |
| LOW | tests/test_transform.py | 778 | def test_transform_to_strict_not_supported(fresh_db, method_name): | STRING |
| LOW | tests/test_transform.py | 831 | def test_transform_retains_indexes_with_foreign_keys(fresh_db): | STRING |
| LOW | tests/test_transform.py | 866 | def test_transform_with_indexes_errors(fresh_db, transform_params): | STRING |
| LOW | tests/test_transform.py | 883 | def test_transform_with_unique_constraint_implicit_index(fresh_db): | STRING |
| LOW | tests/test_duplicate.py | 39 | def test_duplicate_fails_if_table_does_not_exist(fresh_db): | CODE |
| LOW⚡ | tests/test_plugins.py | 9 | def _supports_pragma_function_list(): | CODE |
| LOW⚡ | tests/test_plugins.py | 20 | def test_get_plugins_loads_setuptools_entrypoints_once(monkeypatch): | CODE |
| LOW | tests/test_plugins.py | 36 | def test_get_plugins_does_not_load_setuptools_entrypoints_in_tests(monkeypatch): | CODE |
| LOW | tests/test_wal.py | 27 | def test_enable_wal_inside_transaction_raises(db_path_tmpdir): | CODE |
| LOW | tests/test_wal.py | 40 | def test_disable_wal_inside_transaction_raises(db_path_tmpdir): | CODE |
| LOW | tests/test_wal.py | 52 | def test_ensure_autocommit_on(db_path_tmpdir): | CODE |
| LOW | tests/test_wal.py | 63 | def test_enable_wal_noop_inside_transaction_is_allowed(db_path_tmpdir): | CODE |
| LOW | tests/test_wal.py | 74 | def test_ensure_autocommit_on_inside_transaction_raises(db_path_tmpdir): | CODE |
| LOW | tests/test_extracts.py | 72 | def test_extracts_null_values(fresh_db): | CODE |
| LOW | tests/test_extracts.py | 96 | def test_extracts_null_values_list_mode(fresh_db): | CODE |
| LOW | tests/test_cli_migrate.py | 33 | def two_sets_same_migration_name(tmpdir): | STRING |
| LOW | tests/test_cli_migrate.py | 110 | def test_list_same_migration_names_in_different_sets(capsys): | STRING |
| LOW | tests/test_cli_migrate.py | 230 | def test_stop_before_multiple_sets_unqualified(two_migrations): | STRING |
| 399 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 452 | CODE | |
| LOW | sqlite_utils/db.py | 5188 | CODE | |
| LOW | sqlite_utils/db.py | 513 | CODE | |
| LOW | sqlite_utils/db.py | 1248 | CODE | |
| LOW | sqlite_utils/db.py | 1717 | CODE | |
| LOW | sqlite_utils/db.py | 2503 | CODE | |
| LOW | sqlite_utils/db.py | 2633 | CODE | |
| LOW | sqlite_utils/db.py | 2917 | CODE | |
| LOW | sqlite_utils/db.py | 3053 | CODE | |
| LOW | sqlite_utils/db.py | 3924 | CODE | |
| LOW | sqlite_utils/db.py | 3971 | CODE | |
| LOW | sqlite_utils/db.py | 4188 | CODE | |
| LOW | sqlite_utils/db.py | 4341 | CODE | |
| LOW | sqlite_utils/db.py | 4978 | CODE | |
| LOW | sqlite_utils/db.py | 2725 | CODE | |
| LOW | sqlite_utils/cli.py | 1047 | CODE | |
| LOW | sqlite_utils/cli.py | 2102 | CODE | |
| LOW | sqlite_utils/cli.py | 2260 | CODE | |
| LOW | sqlite_utils/cli.py | 2905 | CODE | |
| LOW | sqlite_utils/cli.py | 3748 | CODE | |
| LOW | sqlite_utils/cli.py | 2943 | CODE | |
| LOW | sqlite_utils/utils.py | 144 | CODE | |
| LOW | sqlite_utils/utils.py | 265 | CODE | |
| LOW | sqlite_utils/utils.py | 292 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 916 | except Exception: | STRING |
| LOW | sqlite_utils/db.py | 1117 | except Exception: | STRING |
| LOW | sqlite_utils/db.py | 1143 | except Exception: | STRING |
| LOW | sqlite_utils/cli.py | 70 | except Exception: | CODE |
| LOW | sqlite_utils/cli.py | 1134 | except Exception as e: | STRING |
| LOW | sqlite_utils/cli.py | 3322 | except Exception as ex: | STRING |
| MEDIUM | sqlite_utils/cli.py | 3319 | def wrapped_fn(value): | CODE |
| LOW | sqlite_utils/utils.py | 545 | except Exception: | CODE |
| LOW | tests/conftest.py | 58 | except Exception: | CODE |
| LOW⚡ | tests/test_plugins.py | 14 | except Exception: | CODE |
| LOW | tests/test_cli.py | 24 | except Exception: | CODE |
| LOW | docs/conf.py | 53 | except Exception: | CODE |
| LOW | docs/conf.py | 82 | except Exception: | CODE |
| MEDIUM | docs/conf.py | 50 | def _linkcode_git_ref(): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | sqlite_utils/db.py | 1034 | # default into a string ('TRUE' instead of 1, 'NULL' instead of null). | STRING |
| HIGH | sqlite_utils/db.py | 5034 | # Optimization - if all rows are null, don't run this query | STRING |
| HIGH | tests/test_extracts.py | 74 | # Null values should stay null, not be extracted into the lookup table | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | sqlite_utils/db.py | 490 | # Create an in-memory database: | COMMENT |
| MEDIUM | sqlite_utils/db.py | 2069 | # This method is defined on Queryable so it serves views too, which | STRING |
| MEDIUM | tests/test_transform.py | 885 | # Create a table with a UNIQUE constraint on 'name', which creates an implicit index | STRING |
| MEDIUM | tests/test_cli.py | 913 | # Create a temporary file with function definitions | STRING |
| MEDIUM | tests/test_m2m.py | 164 | # Create a candidate | COMMENT |
| MEDIUM | docs/conf.py | 9 | # This file is execfile()d with the current directory set to its | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 513 | CODE | |
| LOW | sqlite_utils/db.py | 1389 | CODE | |
| LOW | sqlite_utils/db.py | 1566 | CODE | |
| LOW | sqlite_utils/db.py | 2153 | CODE | |
| LOW | sqlite_utils/db.py | 2397 | CODE | |
| LOW | sqlite_utils/db.py | 2503 | CODE | |
| LOW | sqlite_utils/db.py | 2633 | CODE | |
| LOW | sqlite_utils/db.py | 3685 | CODE | |
| LOW | sqlite_utils/db.py | 4272 | CODE | |
| LOW | sqlite_utils/db.py | 4341 | CODE | |
| LOW | sqlite_utils/db.py | 4701 | CODE | |
| LOW | sqlite_utils/db.py | 4739 | CODE | |
| LOW | sqlite_utils/db.py | 4790 | CODE | |
| LOW | sqlite_utils/cli.py | 1047 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/__init__.py | 1 | CODE | |
| LOW | sqlite_utils/__init__.py | 2 | CODE | |
| LOW | sqlite_utils/__init__.py | 3 | CODE | |
| LOW | sqlite_utils/__init__.py | 4 | CODE | |
| LOW | sqlite_utils/__init__.py | 5 | CODE | |
| LOW | sqlite_utils/recipes.py | 1 | CODE | |
| LOW | sqlite_utils/migrations.py | 7 | CODE | |
| LOW | sqlite_utils/migrations.py | 7 | CODE | |
| LOW | tests/test_register_function.py | 2 | CODE | |
| LOW | tests/test_register_function.py | 3 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | docs/conf.py | 1 | #!/usr/bin/env python3 | COMMENT |
| LOW | docs/conf.py | 21 | # | COMMENT |
| LOW | docs/conf.py | 101 | COMMENT | |
| LOW | docs/conf.py | 161 | # Theme options are theme-specific and customize the look and feel of a theme | COMMENT |
| LOW | docs/conf.py | 181 | COMMENT | |
| LOW | .github/workflows/codeql-analysis.yml | 41 | # If you wish to specify custom queries, you can do so here or in a config file. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 4455 | # Check if this is list mode or dict mode | STRING |
| LOW | sqlite_utils/cli.py | 3766 | # Check if this is a file path | COMMENT |
| LOW | sqlite_utils/utils.py | 539 | # Check if code is a direct callable reference | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/__init__.py | 7 | __all__ = ["Database", "Migrations", "suggest_column_types", "hookimpl", "hookspec"] | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlite_utils/db.py | 5053 | # No need to run the query if it will just return the results in reverse order | STRING |