Okay first these Database aspects should all be contained within their own Class that is its own file. (aka MyDatabaseClass.py)
Then you just import that file into your Main Application and call the various APIs that you have put within your DbClass to autonomously perform any action/request that is needed.
For instance if the program does not need to be logged into but the database does then -- in the app you pop a window and get the database login credentials that you then pass to the DbClass' Login method where it then validates the user and then perhaps passes back an encrypted login session credential that the user's app can then use going forward for that specific session.
Then the app can perform all the rest of its functionality that is needed without needing to login again and again
Next your DbClass should just create a the secure connection to the Sequel Server Database behind the scenes using the credential it created each time it is making a request.
Doing it this way -- once you have it working allows you to then do things like move the DbClass into its own thread and/or into its own process -- depending on which is needed.
But you have to get the basic separation in place in order to and even more separated state -- basically the App (which I assume is the GUI) knows absolutely nothing about that Database beyond the API functions it needs to call -- it never ever creates a query it simply passes parameters to an API that in turn passes back a Dictionary or List result. Further your DbClass has no concept of what the data it is sending back is being used for nor does it care. Its job is solely to interface with the database engine of choice and get the information and send it back as a dictionary or list depending on its design
NOTE: If I state something you have already done great just keep in mind that I am writing this for you and anyone else that might be interested in this topic so I am covering all the elements as we progress -- so just skim over anything you have already done
Then you just import that file into your Main Application and call the various APIs that you have put within your DbClass to autonomously perform any action/request that is needed.
For instance if the program does not need to be logged into but the database does then -- in the app you pop a window and get the database login credentials that you then pass to the DbClass' Login method where it then validates the user and then perhaps passes back an encrypted login session credential that the user's app can then use going forward for that specific session.
Then the app can perform all the rest of its functionality that is needed without needing to login again and again
Next your DbClass should just create a the secure connection to the Sequel Server Database behind the scenes using the credential it created each time it is making a request.
Doing it this way -- once you have it working allows you to then do things like move the DbClass into its own thread and/or into its own process -- depending on which is needed.
But you have to get the basic separation in place in order to and even more separated state -- basically the App (which I assume is the GUI) knows absolutely nothing about that Database beyond the API functions it needs to call -- it never ever creates a query it simply passes parameters to an API that in turn passes back a Dictionary or List result. Further your DbClass has no concept of what the data it is sending back is being used for nor does it care. Its job is solely to interface with the database engine of choice and get the information and send it back as a dictionary or list depending on its design
NOTE: If I state something you have already done great just keep in mind that I am writing this for you and anyone else that might be interested in this topic so I am covering all the elements as we progress -- so just skim over anything you have already done