I am looking for a way to take results from an SQLite database, select part of the schema, and recreate this on a remote machine via paramiko without the intermediate step of a local file or any form of remote file that is not a pure SQLite database.
This blog post sets up a nice way to potential get the part of the schema I want but I would have to dump this to a file then read it into the database via a remote script afterwards:
http://blog.marcus-brinkmann.de/2010/08/27/how-to-use-sqlites-backup-in-python/
I know paramiko can provide remote file like objects like this:
f = self.sftp.open(path, 'wb')
f.write(fileobj.read())
f.close()
Is there any way to combine some file object, StringIO, or byte conversion with one of the SQLite DB APIs in order to provide a way to stream a prebuilt SQLite database without extra file writes on the host or remote?
In other words something like this:
f = self.sftp.open(path, 'wb')
conn = sqlite3.connection(f)