Skip to content

Commit 203901b

Browse files
committed
Add a default clientInfo connection property.
If the application doesn't provide its own clientInfo property, use a default of 'pynuodb'.
1 parent d5a4840 commit 203901b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

pynuodb/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def connect(database, host, user, password, options=None, **kwargs):
3737
options -- A dictionary of NuoDB connection options
3838
Some common options include:
3939
"schema"
40+
"clientInfo"
4041
4142
:type database: str
4243
:type host: str
@@ -82,6 +83,7 @@ def __init__(self, dbName, broker, username, password, options, **kwargs):
8283
options -- A dictionary of NuoDB connection options
8384
Some common options include:
8485
"schema"
86+
"clientInfo"
8587
kwargs -- Extra arguments passed to EncodedSession
8688
8789
Returns:

pynuodb/encodedsession.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ def open_database(self, db_name, parameters, cp):
170170

171171
(remote_options, _) = self._split_options(parameters)
172172

173+
if 'clientInfo' not in remote_options:
174+
remote_options['clientInfo'] = 'pynuodb'
175+
173176
self._putMessageId(protocol.OPENDATABASE).putInt(protocol.CURRENT_PROTOCOL_VERSION).putString(db_name).putInt(len(remote_options)) # noqa: E501
174177
for (k, v) in remote_options.items():
175178
self.putString(k).putString(v)
@@ -206,6 +209,9 @@ def open_database_on_secure_connection(self, db_name, parameters):
206209

207210
(remote_options, _) = self._split_options(parameters)
208211

212+
if 'clientInfo' not in remote_options:
213+
remote_options['clientInfo'] = 'pynuodb'
214+
209215
self._putMessageId(protocol.OPENDATABASE).putInt(protocol.CURRENT_PROTOCOL_VERSION).putString(db_name).putInt(len(remote_options)) # noqa: E501
210216
for (k, v) in remote_options.items():
211217
self.putString(k).putString(v)

0 commit comments

Comments
 (0)