Closed ptchankue closed 9 years ago
Timeout has nothing to do with it. Please try to add lazy_connect: True just below retry_connect and try again.
Thanks for your reply. But I tried that it didn't work I still have the same error:
File "/Library/Python/2.7/site-packages/cqlengine/query.py", line 870, in _execute
tmp = execute(q, consistency_level=self._consistency, timeout=self._timeout)
File "/Library/Python/2.7/site-packages/cqlengine/connection.py", line 89, in execute
raise CQLEngineException("It is required to setup() cqlengine before executing queries")
CQLEngineException: It is required to setup() cqlengine before executing queries
Has only this query problems to run or other too? Could you tell me more about your environment? Have you tried to run it in Django shell? Are you sure Cassandra is working fine?
I have this problem every where I try the same kind of query in my django app.
I try django shell and everything seem to be fine there. I can filter by id, author... and I get a results. The problem is that sometimes it fails because of an OperationTimeout. Same when I use the cql shell. That is why I suspected the timeout settings in the django settings file. This is what I am getting from the django app now, which is what the django shell gives me as well:
OperationTimedOut at /api/persons/8c680558-f301-11e4-abc7-000c290119be/
errors={}, last_host=192.168.10.201
Do you have this error in uwsgi or just regular Django development server?
It occured on the regular django developement server.
I started a new project which does the same thing and I don't have the same problem. There is probably something that I added without knowing in the previous project. I will start removing all unnecessary code and I will see how it goes.
On Thu, May 14, 2015 at 8:38 AM, Rafał Furmański notifications@github.com wrote:
Do you have this error in uwsgi or just regular Django development server?
— Reply to this email directly or view it on GitHub https://github.com/r4fek/django-cassandra-engine/issues/34#issuecomment-101937210 .
Hi Rafal,
The reason why my old code is not working is that it constructs queries like this:
Users: SELECT * FROM None.user_image LIMIT 10000
It can't attach the correct keyspace and when cqlengine tries to connect to it, it fails.
My cassandra settings look correct:
'cassandra': {
'ENGINE': 'django_cassandra_engine',
'NAME': 'mydb',
'TEST_NAME': 'test_ mydb',
'HOST':'127.0.0.1', #
development
'PORT': 9042,
'OPTIONS': {
'replication': {
'strategy_class': 'SimpleStrategy',
'replication_factor': 1
}
},
}
Do you have any ideas where I can make a fix?
Regards,
Patrick
On Thu, May 14, 2015 at 9:20 AM, Patrick Tchankue ptchankue@gmail.com wrote:
It occured on the regular django developement server.
I started a new project which does the same thing and I don't have the same problem. There is probably something that I added without knowing in the previous project. I will start removing all unnecessary code and I will see how it goes.
On Thu, May 14, 2015 at 8:38 AM, Rafał Furmański <notifications@github.com
wrote:
Do you have this error in uwsgi or just regular Django development server?
— Reply to this email directly or view it on GitHub https://github.com/r4fek/django-cassandra-engine/issues/34#issuecomment-101937210 .
I can't say for sure what's wrong with your settings.. Perhaps you're setting 'NAME' option to None somehow? Does my testproject work for you?
Hi Rafal,
I managed to figure out what was wrong. I couldn't connect to cassandra because, a colleague removed the anonymous account on my cassandra server. I wasn't aware of that, it is only today that I accessed the logs and I saw an authentifcation error.
So I added two key values to cassandra settings (USER and PASSWORD), everything seems normal now.
Thanks again for your time, I much appreciate it.
Regards, Patrick
On Fri, Jun 5, 2015 at 10:16 PM, Rafał Furmański notifications@github.com wrote:
I can't say for sure what's wrong with your settings.. Perhaps you're setting 'NAME' option to None somehow? Does my testproject work for you?
— Reply to this email directly or view it on GitHub https://github.com/r4fek/django-cassandra-engine/issues/34#issuecomment-109428221 .
Hah, no problem. I hope you'll find this project useful. Closing then.
i have the same problem :( File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "./users/views.py", line 14, in login if login_form.is_valid(): File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 162, in is_valid return self.is_bound and not bool(self.errors) File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 154, in errors self.full_clean() File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 354, in full_clean self._clean_form() File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 378, in _clean_form cleaned_data = self.clean() File "./users/forms.py", line 15, in clean user = Users.objects.get(email=email) File "build/bdist.linux-x86_64/egg/cqlengine/query.py", line 531, in get return self.filter(_args, _kwargs).get() File "build/bdist.linux-x86_64/egg/cqlengine/query.py", line 533, in get self._execute_query() File "build/bdist.linux-x86_64/egg/cqlengine/query.py", line 317, in _execute_query self._result_cache = list(self._execute(self._select_query())) File "build/bdist.linux-x86_64/egg/cqlengine/query.py", line 251, in _execute result = execute(q, consistency_level=self._consistency, timeout=self._timeout) File "build/bdist.linux-x86_64/egg/cqlengine/connection.py", line 89, in execute raise CQLEngineException("It is required to setup() cqlengine before executing queries")
in uwsgi and manage.py runserver
Hi there! I am trying to run this query
that used to work before but now it fails with the following error:
I suspect that the timeout is not large enough to allow the query to execute. I tried adding this in the cassandra session of my database settings:
But still no luck. Can someone help me?