Python Forum
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
#8
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
Reply


Messages In This Thread
RE: SSH port forwarding and connection to SQL Server in separate threads freezes - by Denni - Nov-06-2019, 04:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GUI freezes while executing a callback funtion when a button is pressed abi17124 5 7,480 Jul-10-2019, 12:48 AM
Last Post: FullOfHelp
  [Tkinter] tkinter freezes by clicking button Zatox11 33 25,688 Apr-10-2018, 09:03 AM
Last Post: Zatox11
  Running telnet loop freezes GUI reedhallen 1 3,441 Jan-27-2018, 10:24 PM
Last Post: j.crater
  Clock freezes - wx.python glib problem strongheart 3 4,027 Oct-10-2017, 03:36 AM
Last Post: strongheart

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020