mercredi 11 février 2015

joining across databases with sqlite3 / pysqlite

I have two separate database files each with tables with matching primary keys, but different data. I want to pull out rows from one table based on values in the other. In the CLI for sqlite3, I would do this like:



.open data.db
.open details.db
attach 'data.db' as data;
attach 'details.db' as details;

select details.A.colA from data.A join details.A using ('key') where data.A.colB = 0 and data.A.colC = 1;


How can I recreate such a cross-database join using pysqlite?


Aucun commentaire:

Enregistrer un commentaire