First, get a read-only inventory of SQL hidden in Python files.
Find embedded SQL
Find triple-quoted strings that look like SQL, then separate safe blocks from dynamic templates before cleanup begins.
py-sql-cleaner list jobs/load_users.pyShows file, variable name, line count, and whether the block is safe to rewrite.
Plain strings are marked safe. f-strings and Jinja-like templates are visible but skipped.
The list command changes nothing, so you can inspect a project before choosing a cleanup command.
jobs/load_users.py# jobs/load_users.py
users_query = """
select user_id, email from analytics.users
"""
sessions_query = f"""
select * from sessions where ds = '{run_date}'
"""py-sql-cleaner list jobs/load_users.pyjobs/load_users.py:14users_query18 linessafejobs/load_users.py:42events_sql24 linessafejobs/load_users.py:76sessions_query31 linesskip · f-stringjobs/load_users.py:118orders_sql12 linessafejobs/load_users.py:144cohort_query44 linesskip · jinja