Merging tables from two different databases (Python) -
i have 2 databases database1.db
, database2.db
. databases contain tables matching names , matching columns (and primary key 'date' column in both). difference between 2 entries in database1 2013 , entries in database2 2014. merge these 2 databases 2013 , 2014 data ends in 1 table in third database (let's call database3.db).
to clear, here databases i'm working contain , want third resulting database contain:
database1.db:
table name: germany_berlin
date morning day evening night 01.01.2013 0.5 0.2 0.2 0.1 02.01.2013 0.4 0.3 0.1 0.2 ...
database2.db:
table name: germany_berlin
date morning day evening night 01.01.2014 0.6 0.2 0.1 0.1 02.01.2014 0.5 0.2 0.3 0.0 ...
i have create resulting database3 following data:
database2.db:
table name: germany_berlin
date morning day evening night 01.01.2013 0.5 0.2 0.2 0.1 02.01.2013 0.4 0.3 0.1 0.2 01.01.2014 0.6 0.2 0.1 0.1 02.01.2014 0.5 0.2 0.3 0.0 ...
i haven't been able find directly helpful on online yet (perhaps joins used somehow? bhttp://www.tutorialspoint.com/sqlite/sqlite_using_joins.htm) suggestions appreciated!
ps. sqlite has been used create existing databases , database-related python library i'm familiar with
you can easly export .db csv (how export sqlite csv in python without being formatted list?) , import again .db (importing csv file sqlite3 database table using python) step 1 append result same cvs file.
Comments
Post a Comment