Python Forum

Full Version: .py to .exe question using PyInstaller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does PyInstaller allow the inclusion of the Data Base i am using for deployment purposes, or should i just include a copy of the DB in the same folder as the .exe?
I imported SQLite3 and started to build the SQLite DB with code in the program and got lazy. Used a DB Browser instead to create all the tables outside code.
Suggestions?
The database file should not be included in the bundle. This will work ONLY if it will be read-only and still I will provide it along the exe, not in the bundle.
If you plan to write/update data, how do you gonna preserve changes in the database?

either provide the db file along the exe (e.g. with installer or create on first run) or you can create run-time hook, see, e.g. https://stackoverflow.com/questions/3383...le-onefile
Thanks for the resources above.
To test my understanding; if i am creating a one-folder bundle and use either --add--data or datas (script) to bundle the existing DataBase, my insert/delete/update's will not commit changes?

So-if true, if i create the one-folder bundle without the DB; can i copy and paste the DB into this folder after PyInstaller creates it? Will the compiled App find the DB like it is doing now-in same folder? If so, i can share it to get some early feedback.

If not, sounds like i might as well code it into my App to create the DB and tables the first time the App is ran?
Is the latter the typical way it is handled?
(Feb-18-2022, 02:30 PM)hammer Wrote: [ -> ]if i am creating a one-folder bundle
Maybe I misunderstood this
(Feb-18-2022, 01:59 AM)hammer Wrote: [ -> ]Does PyInstaller allow the inclusion of the Data Base i am using for deployment purposes, or should i just include a copy of the DB in the same folder as the .exe?
My understanding was that you are creating one-file bundle

Read Run-time Information section of the docs which explains how you can know which path to use, i.e. to executable, or to the bundle, etc.
Thanks for the direction-i will.