Using strings with ' in them in SQL-queries
thomas at cintra.no
thomas at cintra.no
Tue May 30 16:27:49 EDT 2000
Hi,
I need to insert strings with ' in them in query-strings. I`m using
the PostgreSQL-database.
If I try stuff like this :
db = _pg.connection(....)
db.query('insert into test (id, name) value (1, 'fdsfds''fdsf') ')
That works ok. But the string I need to insert I get from a variable.
I cannot seem to use a variable in the query-string. Is there any way
around this? How can I handle characters in strings that may
comprimise the requirements of a valid sql-statement??
Thomas
More information about the Python-list
mailing list