title: python sqlite3 multiple-databases
body: <p>I have the same data data spread out over many identical databases.  I want to combine all this data into one database ( well over a million records)</p>
  
  <p>I have connection objects and cursor objects from the donating database and the receiving database and am keeping careful track of them.   Then I am doing a [SELECT * …]  from the donating database and 
  In the fetchall , trying to INSERT INTO  the archive.  This seems to work, but will never take variables:
  […. VALUES  (557)]  will nicely add 557.  But [….VALUES (?)” (var_name))]   never works. </p>
  
  <pre class="lang-py prettyprint-override"><code>import sqlite3
  
  conn = sqlite3.connect ('small_no_sort_2')
  c = conn.cursor()
  conn_rec = sqlite3.connect ('may_22_2019_int_db')  # new database,,,table is first_table
  c_rec = conn_rec.cursor()
  
  def data_entry_col_three():
      c_rec.execute ("INSERT INTO first_table (column_five) VALUES   (?)", (var))
      conn_rec.commit()
  
  c.execute ("SELECT column_five FROM first_table WHERE column_five &gt; 1809200 and column_five &lt; 1822000 ")
  all_rows = c.fetchmany(15)
  for row in all_rows:
      if (row[0]) &gt; 1819700 and row[0]&lt; 1822799:
          print (row[0])
          var = row[0]
          var = str(var)
          var = (var[0:7])
          var = int(var)
          print (type(var))
          print (".....")
          print (var)
          new_var = 2000
          data_entry_col_three()
  
  </code></pre>
  
  <p>Notice that I have fussed with the data types at some length.  [data_entry_col_three] this function will take a number, but not a variable.  The ……………….VALUES  (33445)  will work, but not …………………VALUES (?),”(var)).</p>