Hi

Re. timh: OK, I understand that keep open connection which is based on 
threads, in frontend is prohibited. So, what is the easiest and clearest 
way how to solve it?

What I tried:

* convinced PyMongo to work without threads. Tried many parameters (from 
here http://api.mongodb.org/python/current/api/pymongo/mongo_client.html ) 
during conectin established but still GAE end on timeout.

* observe another connecion service like Motor 
 https://motor.readthedocs.org/en/stable/  asyncmongo 
https://github.com/bitly/asyncmongo  micromongo 
http://pythonhosted.org/micromongo/  mongoengine http://mongoengine.org/
Most of them depend on pymongo and another ones have unsuitable atributes. 
Maybe, after many hours of research some of them will be usefull.

* Tried to encapsulate connection to co-routine functionality. This is 
working, but only on development server.
def coroutine_db_connection():
    client = pymongo.MongoClient(MONGO_URI)
    DBCON = client.get_default_database()
    while True:
        yield DBCON

* Tried run DB connection on separate backend module. Old backend is 
depricated and new one, modules based is badly documented. Cannot find 
usable example :( 
 Find https://cloud.google.com/appengine/docs/python/modules/
Is there some step-by-step tutorial how to made simple GAE backend module 
and how to take variable (open connection handle in my case) from backend 
to frontend?

Also I'am afraid about $cost if the connection will be open in backend 
thread for lifetime of instance. Any clarify of that will be helpfull.

* Made changes in PyMongo - in progress, I explore this files now.


--- Oh my GOD, keep open connection to database is such a simple task, in 
another environment... ---









-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/4ae07024-5022-4417-8463-ab0f3137e061%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to