Passing tuples of tuples to sqlite
lolmcbride at googlemail.com
Mon Sep 28 17:18:17 CEST 2009
On 28 Sep, 13:52, lolmc <lolmcbr... at googlemail.com> wrote:
> On 28 Sep, 11:35, xera121 <lolmcbr... at googlemail.com> wrote:
> > Hi
> > I have tuples in the format shown below:
> > (u('2','3','4'),u('5','6','7')........u('20','21','22'))
> > but they are not being accepted into sqlite - due I think to the
> > excessive quote marks which are confusing the issue when converting to
> > a string to send it to sqlite.
> > Can someone advise me on how I should format the strings so the whole
> > tuple of tuples will be accepted in the sqlite insert query?
> > Thanks
> > Lol McBride
> After receiving an email I realised that the way I have presented the
> tuple unicode formatting is incorrect. I will post proper code when I
> get access to my machine later to day.
> Lol Mc
Did some SSh and vnc majic and I've got the proper formatting:
[(u'(7, 28, 36)', u'(35, 47, 49)', u'(25, 34, 46)', u'(2, 5, 40)',
u'(7, 24, 35)', u'(8, 17, 20)', u'(24, 33, 37)', u'(5, 8, 19)')]
So what i want to do is put the above into a primary key field so that
I know when duplicates have occurred and I only add unique data into
the field.When I have copied the string of the query into sqlitemanger
and tried to execute it ther it says ther is an error in the SQL query
at ',' - which is not too helpful as I am not sure if it is the
first , or 3rd or last , which is causing the problem!
I have a feeling though that it is the quote mark after the unicode
delimiter which is the issue but I'm not 100% sure - can anyone shed
light on this and offer a solution?
More information about the Python-list