I do not know cassandra well enough. You can use
connection = cache.ram('cassandra', lambda: establish_connection(), None)
so the connection is cached in ram. The DAL has pooling and works better
but nobody wrote a cassandra adapter. Perhaps you could try that.
On Wednesday, 29 March 2017 23:33:01 UTC-5, Nicolas Petitclerc wrote:
>
> Hi,
> I'm using external Python driver (e.g.,
> https://github.com/datastax/python-driver) to use Cassandra in web2py,
> but the issue I have is that I need to get a new Cassandra connection on
> every query (and this is quite slow, 2-3 sec).
>
> *So I wonder if there is a way to preserve a connection?*
>
> I though of saving it into the session, but the object can't be pickled,
> so I can't do that. If I create it in models/db.py it still gets created on
> every page load...
>
> Thanks.
>
> On Monday, January 27, 2014 at 4:40:16 PM UTC+1, Alan Etkin wrote:
>>
>>
>>
>> The DAL does not have a Cassandra adapter, so you'll have to use an
>>> external Python driver (e.g., https://github.com/datastax/python-driver
>>> ).
>>>
>>
>> Or code your own adapter (and perhaps share it)
>>
>>
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Note-on-new-DAL-and-adapters
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.