Error while dumping out data from sqlite3
Question: I have used **sqlite3_connection.iterdump()** method to dump the sqlite3 the
database.

I have written a module in python that dumps out the sqlite3 tables. The
module works fine if I run it locally in my machine.

And, After creating a python package of the module using pyinstaller, if I try
to dump out the database it gives an error saying

    
    
    "ImportError: No module named sqlite3.dump"
    

Any idea how I can solve this issue. Or is there any alternative to get the
sqlite3 dump.

Here is what I'm following to dump the database.

    
    
    #Export database
    def export_database(self):
        database_string = ""
        for line in self.conn.iterdump():
                database_string += '%s\n' % (line)
        return database_string
    
    #Import database
    def import_database(self, database_string):
        self.cursor.executescript(database_string)
    


Answer: Please verify that you have have the file `hooks/hook-sqlite3.py` under your
_PyInstaller_ installation directory. If you don't have it please install the
[latest _PyInstaller_
version](https://github.com/pyinstaller/pyinstaller/wiki#downloads).

* * *

If you're unable to install the latest version, create the file `hook-
sqlite3.py` with the following content:

    
    
    from PyInstaller.hooks.hookutils import collect_submodules
    hiddenimports = collect_submodules('sqlite3')
    

When building, supply the path to the directory in which you placed the hook
file as a value to the `--additional-hooks-dir` argument, as follows:

    
    
    --additional-hooks-dir=<path_to_directory_of_hook_file>
    

* * *

As per the comment below, it seems that adding `--hidden-import=sqlite3` while
building works as well.

