Recently updated Twisted from 11 to 12 version. Discovered that the twisted.enterprise.util module no longer exists.
I used to do this:
from twisted.enterprise import adbapi, util as dbutil
query = "select userid, password from user where username = %s" % (
dbutil.quote(credentials.username, "char"))
Now what we need to use third-party library?
The proper way is with “bind parameters”. This keeps SQL separate from
data and removes the entire category of bugs due to misquoting. The way
to use bind parameters is to pass the SQL string as a separate argument
from the SQL data. Using DB-API 2.0, this means something like:
Using ADBAPI, it means something very similar:
Different database adapters use different syntaxes for the “?” part. The
`paramstyle´ attribute of the DB-API 2.0 module tells you what syntax a
particular module uses. See the DB-API 2.0 PEP
( http://www.python.org/dev/peps/pep-0249/ ) for details.
Source: http://twistedmatrix.com/pipermail/twisted-python/2009-March/019268.html