Open usimd opened 3 years ago
Can you point to the documentation that lead you to use a semicolon as a separator in a URL?
I am sure we can clarify that with a bit more info.
Also, did you find the example programs? Were they helpful?
Can you describe the search path you used to find docs on this? Google? Links? What queries?
On Fri, Aug 6, 2021 at 4:36 AM usimd @.***> wrote:
I'm trying to connect to a MapR data access gateway using Python OJAI v1.1.5.
Using the documented connection string with a format like host:port?[param=value;...] does not work. The options_dict only contains one single entry with the first param's key and the rest of the connection string as value.
I assume https://github.com/mapr/maprdb-python-client/blob/master/mapr/ojai/storage/OJAIConnection.py#L115-L116 does not respect semicolon as a separator.
Quickly checking if using an ampersand as separator, I was able to open a connection. This should either be reflected in the docs or the code should properly handle the separator.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mapr/maprdb-python-client/issues/71, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5E6TRXZMGIW5XT3YOKSLT3PCKPANCNFSM5BVXVXZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Hi @tdunning! Thanks for your quick response.
The official docs on the MapR website is instructing to use the semicolon: https://docs.datafabric.hpe.com/61/MapR-DB/JSON_DB/GettingStartedPythonOJAI.html The examples you mentioned are using the same syntax: https://github.com/mapr-demos/ojai-examples/blob/master/python/001_get_connection_create_document.py#L4-L7
Not sure if this was working before, this is the first time I'm using the Python client. The Java thin driver does work with the semicolon syntax, however.
Excellent feedback. Thanks!
The point about there being a difference between Python and Java behavior is particularly important. Appreciate your noticing that.
Also, remember that you can give feedback directly on the doc pages. I will be doing just that in about 5 minutes.
On Sun, Aug 8, 2021 at 3:06 AM usimd @.***> wrote:
Hi @tdunning https://github.com/tdunning! Thanks for your quick response.
The official docs on the MapR website is instructing to use the semicolon: https://docs.datafabric.hpe.com/61/MapR-DB/JSON_DB/GettingStartedPythonOJAI.html The examples you mentioned are using the same syntax: https://github.com/mapr-demos/ojai-examples/blob/master/python/001_get_connection_create_document.py#L4-L7
Not sure if this was working before, this is the first time I'm using the Python client. The Java thin driver does work with the semicolon syntax, however.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapr/maprdb-python-client/issues/71#issuecomment-894773655, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5E6UPDIC3MOQBYYZLHXLT3ZJI7ANCNFSM5BVXVXZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
I just tested this with my home cluster and with code like this:
host = "localhost:5678"
user = getpass.getuser()
pw = getpass.getpass()
ca = "./cert/cacert.pem"
connection_str = "%s?auth=basic;user=%s;password=%s;" \
"sslCA=%s;" \
"sslTargetNameOverride=%s" % (host, user, pw, ca, "nodea")
connection = ConnectionFactory.get_connection(connection_str=connection_str)
This code uses semis and it works. It looks a lot like the form that you say doesn't work. I am very curious what the difference is in our code.
Did you actually include the square brackets in your URL? Can you post the key snippet of your code?
Very curious!
I've tried it like this:
connection_str = 'host:20802?'\
'auth=basic;'\
'user=user;'\
'password=password-containing-special-chars-but-not-semicolon;'\
'sslCA=/home/user/certs.pem'
connection = ConnectionFactory.get_connection(connection_str=connection_str)
Stacktrace:
Traceback (most recent call last):
File "/home/user/clean-jobs.py", line 11, in <module>
connection = ConnectionFactory.get_connection(connection_str=connection_str)
File "/home/user/venv/lib/python3.8/site-packages/mapr/ojai/storage/ConnectionFactory.py", line 37, in get_connection
return OJAIConnection(connection_str=connection_str, options=options)
File "/home/user/venv/lib/python3.8/site-packages/mapr/ojai/storage/OJAIConnection.py", line 61, in __init__
self.__ssl_ca, self.__ssl_target_name_override = OJAIConnection.__parse_connection_url(
File "/home/user/venv/lib/python3.8/site-packages/mapr/ojai/storage/OJAIConnection.py", line 131, in __parse_connection_url
raise AttributeError(
AttributeError: sslCa path must be specified when ssl enabled.
My assumption regarding the wrong separator originated from inspecting the options dictionary during debugging:
Just tried it one more time. As you can see, the dict only contains one single entry (the first auth
param) which get's mapped the substring from the first equal sign to the end of the string.
EDIT: fwiw, replacing the three semicolons in the connection_str
definition with ampersands works fine.
I'm trying to connect to a MapR data access gateway using Python OJAI v1.1.5.
Using the documented connection string with a format like
host:port?[param=value;...]
does not work. Theoptions_dict
only contains one single entry with the first param's key and the rest of the connection string as value.I assume https://github.com/mapr/maprdb-python-client/blob/master/mapr/ojai/storage/OJAIConnection.py#L115-L116 does not respect semicolon as a separator.
Quickly checking if using an ampersand as separator, I was able to open a connection. This should either be reflected in the docs or the code should properly handle the separator.