Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing methode for dissconnect, how is connections handled? #58

Closed
ghost opened this issue Jan 15, 2021 · 1 comment
Closed

Missing methode for dissconnect, how is connections handled? #58

ghost opened this issue Jan 15, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 15, 2021

import getpass
from requests_ntlm import HttpNtlmAuth
user = "mydomain\" + getpass.getuser()
pwd = getpass.getpass()
auth = HttpNtlmAuth(user, pwd)
c = tagreader.IMSClient(datasource="myplant", url="api.mycompany.com/aspenone", imstype="aspenone", auth=auth, verifySSL=False)
c.connect()

d.disconnect() <----- Add methode for disconnecting not leaving a lot of open connections

@einarsi
Copy link
Collaborator

einarsi commented Jan 15, 2021

It is true that ODBC disconnections aren't handled directly by tagreader. However, one client object uses only one connection and one cursor object. When the client object is deleted or otherwise goes out of scope, e.g. by terminating the application, the cursor/connection will also be closed and deleted. I have therefore not seen the need for an explicit disconnect() method so far, except for in PEP 20: "Explicit is better than implicit". But it would probably be quite trivial to add one - if someone could demonstrate it is indeed needed.

@einarsi einarsi closed this as completed Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant