jeudi 2 avril 2015

Python : What is the best est way to extract data from multiple SQLite databeses and insert then into one PostgreSQL database

I would like to write a Python script that would automate copying data from multiple SQLite3 databases into one PostgreSQL database.


Let me describe the situation: I have a folder with results from different marketing campaign that my colleague is doing. The results of each campaign is kept into one SQLite database. I want to create a centralized database in PostgreSQL to keep the results of each campaign that runs weekly.


My idea is to



  1. export the data from SQLite into a CSV file.

  2. create a temporary table in the PostgreSQL database

  3. check if the results in the new temp table already exist in my database and insert them or not.


I want to run a python script that once I run it, it will do this automatically.


Is there a better way ?


What about using SQLAlchemy ? It would be suitable for this project ? Is it worth learning it? By the way, I am beginner in Python :)


Aucun commentaire:

Enregistrer un commentaire