title: Writing to a remote MySql DB with Python
body: <p>I'm new to coding so I do apologise for any blatant faux pas I may made in my design concept.</p>
  
  <p>I am looking to design a very basic app using Python which will scan for Access Points and log their details in a remote MySql database. My code works fine at present and writes the information to a locally held database no problem but now my query is, what pitfalls will their be when looking to insert the values into a remote DB? The broadband connection will be a 3G mobile connection and my concern is, if ran in a blackspot with no 3G coverage, how can I stall it so that the data is just held locally until coverage returns?</p>
  
  <p>Here's my code thusfar:-</p>
  
  <pre><code>while 1:
      s.send('\n!0 enable CLIENT bssid,mac,manuf,type,minlat,minlon,maxlat,maxlon,agglat,agglon,bestlat,bestlon,gpsfixed,signal_dbm,noise_dbm,firsttime,lasttime')
  
      buff = s.recv(512)
      tmp = buff.split()
      bssid = tmp[1]
      mac = tmp[2]
      manuf = tmp[3]
      type = tmp[4]
      minlat = tmp[5]
      minlon = tmp[6]
      maxlat = tmp[7]
      maxlon = tmp[8]
      agglat = tmp[9]
      agglon = tmp[10]
      bestlat = tmp[11]
      bestlong = tmp[12]
      gpsfixed = tmp[13]
      signal_dbm = tmp[14]
      noise_dbm = tmp[15]
      firsttime = tmp[16]
      lasttime = tmp[17]
  
      if bssid != mac:
          cursor.execute("""INSERT INTO data (bssid, mac, manuf, type,
  minlat, minlon, maxlat, maxlon, agglat, agglon, bestlat, bestlong,
  gpsfixed, signal_dbm, noise_dbm, firstime, lasttime)
                         VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
  %s, %s, %s, %s, %s, %s, %s)""",
                         (bssid, mac, manuf, type, minlat, minlon,
  maxlat, maxlon, agglat, agglon, bestlat, bestlong, gpsfixed,
  signal_dbm, noise_dbm, firstime, lasttime) )
      else:
          pass
  </code></pre>
  
  <p>As said, the code works fine and so it's not really a question about my code but more about what I should consider when using a remote MySql DB and mobile broadband coverage. As I will be scanning access points whilst out and about, I am aware that I could have no 3G coverage for 10 minutes for example and will have detected, say 200 access points so just wondering how is best to deal with this? Write them to RAM, a temp file or a local DB and then update when 3G connection is back in place?</p>
  
  <p>Thanks</p>