I am using https://github.com/mattn/go-sqlite3 in a Golang application. I need to use multiple databases, and was wondering whether I can use ATTACH and DETACH in Golang (http://sqlite.org/lang_attach.html).
I don't have any code right now, because I don't know how else to tackle this problem except creating two database connections and joining data in the application:
db1, err := sql.Open("sqlite3", "./db1.db")
db2, err := sql.Open("sqlite3", "./db2.db")
// query db1 and db2
// put into map
// join data
It would be much easier if you could use:
attach database database1.db as db1;
attach database database2.db as db2;
select
*
from
db1.SomeTable a
inner join
db2.SomeTable b on b.SomeColumn = a.SomeColumn;