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 __insert(self, data):
> >         query = """
> >             BEGIN;
> >                 INSERT INTO table
> >                     (a,  b,  c,  d,  e,  f,  g)
> >                     VALUES
> >                     (%s, %s, %s, %s, %s, %s, %s);
> >             COMMIT;
> >             """
> >         values = [
> >             data['a'],
> >             data['b'],
> >             data['c'],
> >             data['d'],
> >             data['e'],
> >             data['f'],
> >             data['g']
> >             ]
> >         self.db.execute(query, *values)
>
> You need to pass
>
> None

Hi,

thanks for reply.
Unfortunately, it doesn't work. Still getting TypeError: not enough
arguments for format string


>
> then as that parameter.
>
> Diez

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to