Menu

#1 host for db-access

open
nobody
None
5
2006-12-20
2006-12-20
Anonymous
No

It would be nice to be able to connect to a database that is located at a host that is not the local machine. Until now this is not possible.

For implementation you have to change the method def __init__(self, **kwargs) in file dataset.py as follows:

1) add the following line at the beginning
self.host = None # host name

2) add the following lines in the for loop:

elif (keyword == 'host'):
if (not isinstance(value, str)):
logging.exception('Argument "host" is not a string')
raise Exception
self.host = value

3) extend the database connection part as follows:

self.database = MySQLdb.Connect(host=self.host, db=self.database_name, user=self.database_user, passwd=pwd)

Don't forget to update documentation :-) (which is a great one by the way !!).

Andreas

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.