-
Notifications
You must be signed in to change notification settings - Fork 102
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
txmongo not working with azure cosmos db #261
Comments
Hi! Unfortunately I don't have access to CosmoDB to reproduce the issue. Are you sure this isn't related to authentication issue? |
How can I know it's an authentication issue ? NB: azure cosmos DB has a free access https://devblogs.microsoft.com/cosmosdb/build-apps-for-free-with-azure-cosmos-db-free-tier/ |
|
Great ! Thanks for your amazingly fast response. I'll try to capture more error messages on this first call (NB: the authentication and all connection parameters are embedded in the uri) |
As I thought that the error might be in the parsing of the uri, I directly called Also I wasn't able to get a good error message, with the actual reason of why the connection fails. I only get Any idea of how to get the actual error message ? |
If you didn't called any actual query yet, Unfortunately I failed to create Azure account, seems like they do not work directly with customers from Russia anymore 😢 From inspecting the code it seems like DB didnt replied to But this won't answer to the root question: why P.S. Is it possible that default 1 second timeout for |
Thanks for sharing CosmosDB instance! I've tested connection and found two minor issues and one show-stopper :(
Historically MongoDB has two variations of wire protocol: legacy is used in MongoDB <2.6 (IIRC) and newer protocol is used in ≥2.6. TxMongo supports newer protocol for insert and update methods, but still use legacy one for find*(). Some time ago I have started to implement sessions & transactions support for TxMongo which includes using new protocol for find methods. But this patch isn't ready yet and due to lack of spare time it lies on a shelf for a couple of months. I will try to extract new-style find methods from it and make it ready for release. I hope I will be able to do it on the next week. |
Hello, Joaquin, Could you please test this version with Cosmos DB: #262 |
Woaw super cool :-)
I'll test that tomorrow, 11pm in my timezone rn
…On Thu, Apr 2, 2020 at 9:06 PM Ilya Skriblovsky ***@***.***> wrote:
Hello, Joaquin,
Could you please test this version with Cosmos DB?
#262 <#262>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFH53D67IT25236JPGDPELRKSEVXANCNFSM4LRTR7TA>
.
|
Hi Ilya,
(sorry for the delay I had a family issue)
I am bit noob in git and I didn't find the branch with the commit to test.
I can see the commit in github
b016f7e
but when I git show b016f7e
I get a fatal: bad object
probably because I cannot see/access the branch new-style-find
Best,
---Joaquin
On Thu, Apr 2, 2020 at 10:46 PM Joaquín Keller <joaquin.keller@gmail.com>
wrote:
… Woaw super cool :-)
I'll test that tomorrow, 11pm in my timezone rn
On Thu, Apr 2, 2020 at 9:06 PM Ilya Skriblovsky ***@***.***>
wrote:
> Hello, Joaquin,
>
> Could you please test this version with Cosmos DB?
>
> #262 <#262>
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#261 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAFH53D67IT25236JPGDPELRKSEVXANCNFSM4LRTR7TA>
> .
>
|
Sorry for late answer. new-style-find branch is not in twisted/txmongo repository but in my personal fork: https://github.com/IlyaSkriblovsky/txmongo/tree/new-style-find . You may clone my fork or just download a copy of the branch with Download button on this page. |
Oh thanks, I was looking in the wrong place...
Ok, I installed it
<@txmongo>-<⎇ new-style-find>-> python setup.py install --user
I try the same experiment, and I get the same error message:
'TxMongo: run time of 1.0s exceeded.'
However the same mongo uri do work with pymongo...
Did you managed to get it work ?
Can you share your code ? (hiding the actual uri)
Thanks,
-- Joaquín
…On Wed, Apr 8, 2020 at 1:33 PM Ilya Skriblovsky ***@***.***> wrote:
Sorry for late answer.
new-style-find branch is not in twisted/txmongo repository but in my
personal fork:
https://github.com/IlyaSkriblovsky/txmongo/tree/new-style-find . You may
clone my fork or just download a copy of the branch with Download button on
this page <https://github.com/IlyaSkriblovsky/txmongo/tree/new-style-find>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFH53GMXSG56OUMWSFRKQTRLQEBTANCNFSM4LRTR7TA>
.
|
Hmm, that's strange... I've did following:
And it seems to work:
cosmosdb_tx.py: from twisted.internet.ssl import ClientContextFactory
from twisted.internet.task import react
from twisted.internet.defer import *
from twisted.test.ssl_helpers import ClientTLSContext, ServerTLSContext
from txmongo.connection import ConnectionPool
uri = 'mongodb://ql...:pyR...@ql....azure.com:10255/test?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@ql...@'
@react
@inlineCallbacks
def main(reactor):
mc = ConnectionPool(uri, ssl_context_factory=ClientContextFactory())
db = mc.test
yield db.coll.insert_many([{'x': 42}, {'y': 123}])
print('!!', (yield db.coll.find())) I bet it may be because I've changed something in mongodb:// uri. Please try with the same parameters. If any of them raises questions, please ask and I will recall what I've changed and why. |
Ok, now it works, your code gave me the indication of where the problem was: I've added client = ConnectionPool(mongodb_uri, ssl_context_factory=ClientContextFactory())
client.authenticate(dbname, username, password) Just to be sure, I tried the same code with the official (PyPI) distro of txmongo. And it works as well. So what failed is that the authentication data is not (properly) extracted from the uri and and therefore this authentication data has to be passed with the Actually, I removed all the parameters of the uri and it still worked (with the PyPI version also) |
Yes, I've described ssl_context_factory in the post above. DB name is not required if you explicitly call But if PyPI version of txmongo works correctly — this sounds strange. I get following from the same cosmosdb_tx.py shown above with PyPI version of txmongo:
And this is exactly the issue with old-style/new-style find command implementation. But on new-style-find branch I get the correct array printed. Are you sure new-style-find branch doesn't interfere with txmongo version installed from PyPI? For example, if you're testing in git-cloned directory, |
You are right, with the PyPI version the data arrive in the wrong form.
And yes my bad: You did mention `ssl_context_factory` in the post above.
Hey, everything is solved :-)
…On Wed, Apr 8, 2020 at 10:49 PM Ilya Skriblovsky ***@***.***> wrote:
Yes, I've described ssl_context_factory in the post above
<#261 (comment)>.
DB name is not required if you explicitly call authenticate(), you are
right.
But if PyPI version of txmongo works correctly — this sounds strange.
I get following from the same cosmosdb_tx.py shown above with PyPI version
of txmongo:
***@***.***:~/txmongo$ ./venv/bin/python cosmosdb_tx.py
!! [{'cursor': {'firstBatch': [], 'id': 0, 'ns': 'test.coll'}, 'ok': 1.0}]
And this is exactly the issue with old-style/new-style find command
implementation. But on new-style-find branch I get the correct array
printed.
Are you sure new-style-find branch doesn't interfere with txmongo version
installed from PyPI? For example, if you're testing in git-cloned
directory, import txmongo will probably load from the local txmongo
folder rather than from package installed with pip.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFH53ERS3L4VWM4CNXZHOLRLSE7DANCNFSM4LRTR7TA>
.
|
Mmmh, I've never done that before... It would be a first time... |
Sure, just give me some time. |
I have a piece of code that works with pymongo and my cosmos DB uri:
However when I try the same with txmongo:
If the uri is
mongodb://localhost:27017
all good but with the cosmos db uri it doesn't work and I get an error message:TxMongo: run time of 1.0s exceeded.
(Edit: removed the useless
yield
of theConnectionPool
call)The text was updated successfully, but these errors were encountered: