Using standard SQL placeholders in PG
От | Lembark, Steven |
---|---|
Тема | Using standard SQL placeholders in PG |
Дата | |
Msg-id | BN0PR20MB391249E4640F43A8A14B84A4FDB79@BN0PR20MB3912.namprd20.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: Using standard SQL placeholders in PG
|
Список | psycopg |
PostgreSQL ("PG") supports the notion of placeholders, as do many other relational databases. The placeholder notation in PG uses $X within the SQL. For example:
select foo
from bar
where bletch = $1
is valid SQL. The doller-notation allows re-use of positional parameters and avoids SQL injection entirely by placing the input is appropriately-typed buffers w/in the SQL statement handler. It also avoids issues with double-interpolating quotes as the placeholders are not literals and do not require SQL-quoting to be interpolated properly.
We have quite a bit of SQL here that has to be shared between Python and other packages, so using standard PG SQL statements is required.
Q: Is there any way to prepare and execute standard PG SQL statements with dollar placeholders in PsychoPG2?
Thanks
В списке psycopg по дате отправления: