How do I import tables from another database in sqlite using Python?
<p>How do I import data from a column in another table in another database into the current database's table's column? </p>

<p>I tried using the "ATTACH" command, but I'm only allowed to execute one statement at a time.  </p>

<pre><code> cursor.execute(
        "ATTACH DATABASE other.db AS other;\
        INSERT INTO table \
        (column1) \
        SELECT column1\
        FROM other.table;")
</code></pre>

<p>I had to call <code>execute</code> twice, and enclose <code>other.db</code> is single quotations </p>

<pre><code> cursor.execute("ATTACH DATABASE 'other.db' AS other;")
 cursor.execute("\
        INSERT INTO table \
        (ID) \
        SELECT ID \
        FROM other.table ;")
</code></pre>

python sqlite