Extracting data from dump file



I have a large dump file that originated in a MySQL db; I need to get
it into an SQLite file.

Various options are suggested around the web; none of them seem to
work (most failing to import the thing in the first place). So I
removed the assorted taggery from each end, leaving just a big text
file taking the following format:

('value', 'value', 'value, 'value'),
('value','value','value','value')...

I planned to find some way of splitting the thing at the commas
outside the bracketed groups, thus giving me a list of tuples; then I
could of course CREATE TABLE foo VALUES '1', '2, '3', '4' and then
iterate through the list INSERTing INTO.

Then my problems began; I tried using the python csv method, replacing
the string ),( with \t and then using \t as the delimiter. First
problem; there's a size limit coded into the module. No problem, use
csv.field_size_limit() to alter it. Problem; it doesn't actually parse
at all, just sends the whole thing as a string and the SQL INSERT
fails with a "not enough args" error.

Tried using string.split() and re.split(data, r'\t'); first gave the
same error, second failed with a "too many named groups" error. Tried
using ; as a delimiter and going back to csv; this fails to match
the ; for some reason. Any ideas?
.



Relevant Pages

  • Re: Programmers unpaid overtime.
    ... tokenizing a string correctly. ... ability to specify a set of delimiter tokens, ... >> postmodern attack on language itself, ... An the scientists, in turn, think a lot of that artistic talk about ...
    (comp.programming)
  • Re: Surprise in StrConv using vbProperCase
    ... > Your code will capitalize the first letter of a string. ... Use Split(string into array of words using blank as delimiter); ...
    (microsoft.public.access.modulesdaovba)
  • Re: Try Googling for a Definition of the Word "WORD"
    ... In Win32Forth a NULL follow's the string. ... jmp short @@8 ... \ Delimiter is a blank, treat all chars <= 32 as the delimiter ... sub ecx, # 1 ...
    (comp.lang.forth)
  • Re: Clarification
    ... With your strings in column A, select the data and then pick Text to Columns delimited with space and comma as the delimiter. ... And a bit of advice from one who's often been there and done that: forget about the concatenation - leave the data separated by columns. ... With your string in column A, Text to Columns fixed width could give you ... >> re-assemble them using concatenation and copying down ...
    (microsoft.public.excel.misc)
  • Re: VB vs C#
    ... Dim delimiter As String ... Dim testname As String ...
    (microsoft.public.dotnet.general)