Skip to content

Python · maintainability

no-select-star

python:no-select-star

Store queries should select explicit columns instead of `*`.

Code
SARJ021
Default
error
Fix
none
Languages
python

Why

Wildcard projections over-fetch data and can silently change row shapes when the schema evolves.

Fix

List every column consumed by the store result mapping.

Before / after

Executed by this rule’s unit tests.

Before

Store query selects every column

app/call_store.py · focus
QUERY = "SELECT * FROM call"

After

Store query selects named columns

app/call_store.py · focus
QUERY = "SELECT id, status FROM call"

Limits

  • Only SQL string literals in recognized store modules are analyzed.
  • The rule cannot infer the intended projection for an automatic fix.