Asyncpg: SQL injections

Created on 19 Mar 2018  路  2Comments  路  Source: MagicStack/asyncpg

Have this library any tools for protecting sql injections?

If no, maybe somebody recommends how you solve this problem

Thx!

question

Most helpful comment

asyncpg supports native PostgreSQL syntax for parameter substitution:

v = await conn.fetchrow("SELECT * FROM table WHERE id = $1", my_id)

As long as you pass your parameters like that and never build a query string from user inputs, you should be safe from SQL injection.

All 2 comments

asyncpg supports native PostgreSQL syntax for parameter substitution:

v = await conn.fetchrow("SELECT * FROM table WHERE id = $1", my_id)

As long as you pass your parameters like that and never build a query string from user inputs, you should be safe from SQL injection.

Thx a lot!

Was this page helpful?
0 / 5 - 0 ratings