INSERT INTO `examle` (`myid`, `title`, `value`, `usefull`, `picture`, `short_description`, `description`, `wikipedia`, `category`, `date`) VALUES
(1, 'Cat', '3,45', 'No', 'cat.jpg', 'A very useless domestic cat.', 'The cat (Felis catus), also known as the domestic cat or housecat to distinguish it from other felines and felids, is a small carnivorous mammal that is valued by humans for its companionship and its ability to hunt vermin and household pests. It has been associated with humans for at least 9,500 years and is currently the most popular pet in the world.', 'http://en.wikipedia.org/wiki/Cat', 'Sport,Food,Creature', '2009-10-27 16:37:49'),
(3, 'Basketball', '9,45', 'Yes', 'basketball.jpg', 'A Baskeball sport utility.', 'Basketball is a team sport in which two teams of 5 players try to score points against one another by placing a ball through a 10 foot (3.048 m) high hoop (the goal) under organized rules. Basketball is one of the most popular and widely viewed sports in the world.', 'http://en.wikipedia.org/wiki/Basketball', 'Sport', '2009-10-27 16:36:39')
Мне нужно выполнить миграцию этих данных в базу данных с таблицами, структура которых отличается от структуры .sql.
Мой вопрос: : как мне получить все вставки файла и от каждой из них отдельные столбцы и значения? Каждая вставка должна быть словарем в списке.
Я пытался использовать скрипт Python, используя регулярное выражение и разбивая(', ') каждую строку значений, но как некоторые поле имеет ",", сложно правильно разделить значения.
У меня есть файл .sql с предложениями CREATE TABLE и INSERTS TABLE. Пример: [code]INSERT INTO `examle` (`myid`, `title`, `value`, `usefull`, `picture`, `short_description`, `description`, `wikipedia`, `category`, `date`) VALUES (1, 'Cat', '3,45', 'No', 'cat.jpg', 'A very useless domestic cat.', 'The cat (Felis catus), also known as the domestic cat or housecat to distinguish it from other felines and felids, is a small carnivorous mammal that is valued by humans for its companionship and its ability to hunt vermin and household pests. It has been associated with humans for at least 9,500 years and is currently the most popular pet in the world.', 'http://en.wikipedia.org/wiki/Cat', 'Sport,Food,Creature', '2009-10-27 16:37:49'), (3, 'Basketball', '9,45', 'Yes', 'basketball.jpg', 'A Baskeball sport utility.', 'Basketball is a team sport in which two teams of 5 players try to score points against one another by placing a ball through a 10 foot (3.048 m) high hoop (the goal) under organized rules. Basketball is one of the most popular and widely viewed sports in the world.', 'http://en.wikipedia.org/wiki/Basketball', 'Sport', '2009-10-27 16:36:39') [/code] Мне нужно выполнить миграцию этих данных в базу данных с таблицами, структура которых отличается от структуры .sql. Мой вопрос: : как мне получить все вставки файла и от каждой из них отдельные столбцы и значения? Каждая вставка должна быть словарем в списке. Я пытался использовать скрипт Python, используя регулярное выражение и разбивая(', ') каждую строку значений, но как некоторые поле имеет ",", сложно правильно разделить значения.