In article ,
Tim Chase wrote:
>Aahz wrote:
>> Tim Chase 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' fo
Aahz wrote:
Tim Chase 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)
query = """
BEGIN;
INSERT INTO table
(a,b,c,d
In article ,
Tim Chase 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)
> query = """
> BEGIN;
> INSERT
On 25 Mai, 18:16, Tim Chase 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 value
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
--
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)
VALU
On May 25, 3:26 pm, Tim Chase 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):
> q
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 o
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
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):
> >
On May 25, 2:25 pm, Pet wrote:
> On May 25, 2:15 pm, "Diez B. Roggisch" 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, t
On May 25, 2:15 pm, "Diez B. Roggisch" 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(s
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 = """
> BEG
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
14 matches
Mail list logo