Skip to content

Support Template String Queries as Psycopg #899

Open

Description

@aersam

Is your feature request related to a problem? Please describe.

Query building is often done with f-string's in Python which is of course very prone to SQL Injection. Python 3.14 t-strings can solve it and Psycopg shows how great it it:

https://www.psycopg.org/psycopg3/docs/basic/tstrings.html

cursor.execute(
    t"INSERT INTO {table_name:i} (first_name, last_name) VALUES ({first_name}, {last_name})"
)

No SQL Injection here, just a very simple query builder

Describe the solution you'd like

Support t-string same way as psycopg, with same Format specifiers - SQL Dialect might be different, but otherwise we are more consistent

Describe alternatives you've considered

Of course one can still use a full-blown query builder like sqlglot

Additional context

Add any other context about the feature request here.

Activity

  1. github-actions commented on Nov 16, 2026

    @github-actions

    Hi Adrian Ehrsam (@aersam), thank you for opening this issue!

    Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.

    If you have additional information to share, please feel free to update the issue.

    Thank you for your patience!

  2. added
    triage needed
    on Nov 16, 2026
  3. aersam commented on Nov 24, 2026

    @aersam