In article mailman.717.1243258005.8015.python-l...@python.org,
Tim Chase python.l...@tim.thechases.com wrote:
To stave off this problem, I often use:
values = [
data['a'],
data['b'],
data['c'],
data['d'],
data['e'],
data['f'],
data['g'],
]
params = ',
In article mailman.892.1243603377.8015.python-l...@python.org,
Tim Chase python.l...@tim.thechases.com wrote:
Aahz wrote:
Tim Chase python.l...@tim.thechases.com wrote:
To stave off this problem, I often use:
values = [
data['a'],
data['b'],
data['c'],
data['d'],
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def __insert(self, data):
query =
BEGIN;
INSERT INTO table
someone wrote:
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def __insert(self, data):
query =
BEGIN;
On May 25, 2:15 pm, Diez B. Roggisch de...@nospam.web.de wrote:
someone wrote:
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def
On May 25, 2:25 pm, Pet petshm...@googlemail.com wrote:
On May 25, 2:15 pm, Diez B. Roggisch de...@nospam.web.de wrote:
someone wrote:
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such
Pet wrote:
someone wrote:
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def __insert(self, data):
query =
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def __insert(self, data):
query =
BEGIN;
INSERT INTO table
On May 25, 2:50 pm, Peter Otten __pete...@web.de wrote:
Pet wrote:
someone wrote:
Hello!
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
On May 25, 3:26 pm, Tim Chase python.l...@tim.thechases.com wrote:
if one of parameter in values is empty, I'm getting
TypeError: not enough arguments for format string
But how to handle such situation? It is ok for DB, that some of values
are empty.
def __insert(self, data):
To stave off this problem, I often use:
values = [
data['a'],
data['b'],
data['c'],
data['d'],
data['e'],
data['f'],
data['g'],
]
params = ', '.join('%s' for _ in values)
query =
BEGIN;
INSERT INTO table
(a,b,c,d,e,f,g)
VALUES
Pet wrote:
On May 25, 2:50 pm, Peter Otten __pete...@web.de wrote:
cursor.execute(query, *values) # wrong
as far as I know it is not wrong, at least for pyPgSQL it takes values
and escapes properly preventing sql injections
If so replace # wrong with # superfluous ;)
Peter
--
On 25 Mai, 18:16, Tim Chase python.l...@tim.thechases.com wrote:
To stave off this problem, I often use:
values = [
data['a'],
data['b'],
data['c'],
data['d'],
data['e'],
data['f'],
data['g'],
]
params = ', '.join('%s' for _ in values)
13 matches
Mail list logo