Comments (7)
Hi @baali,
thanks for your report.
Are you sure you set up DATABASES
dict in settings.py
correctly? Could you paste it?
If cassandra_connection.connected
is set to True
, then cqlengine.connection.setup
is being called for sure.
from django-cassandra-engine.
@baali please try this from shell:
from django.db import connection
connection.connect()
and let me know if it works. This will work if your only database is cassandra. If not:
from django.db import connections
connections['cassandra'].connect()
from django-cassandra-engine.
Hello @r4fek
Thank you for getting back. Yes doing
connections['cassandra'].connect()
Worked. But trying to run a count query is still throwing up same CQLEngineException. My DATABASES dict in settings.py is this:
'cassandra': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django_cassandra_engine',
'HOST': 'localhost',
'NAME': 'playground',
'OPTIONS': {'connection': {'auth_provider': <cassandra.auth.PlainTextAuthProvider at 0x7f7e0c2a7690>,
'consistency': 10,
'lazy_connect': True,
'protocol_version': 3,
'retry_connect': True},
'replication': {'replication_factor': 1,
'strategy_class': 'SimpleStrategy'},
'session': {'default_fetch_size': 10000, 'default_timeout': 20}},
'PASSWORD': 'pass',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': 'test_db'},
'TIME_ZONE': 'UTC',
'USER': 'user'},
from django-cassandra-engine.
@baali I checked the testproject from this repo with cassandra as secondary backend:
$ cd django-cassandra-engine/testproject
$ export DJANGO_SETTINGS_MODULE="settings.secondary_cassandra"
$ python manage.py sync_cassandra
Creating keyspace db..
Syncing app.models.ExampleModel
Syncing app.models.ExampleModel2
Syncing app.models.TestProjectModel
$ python manage.py shell
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from app.models import *
>>> ExampleModel.objects.create(id=1)
ExampleModel(id=1, created_at=None, deleted=False)
>>> list(ExampleModel.objects.all())
[ExampleModel(id=1, created_at=None, deleted=False)]
As you can see it worked out of the box.
My pip freeze
is:
Django==1.7.7
Jinja2==2.8
Markdown==2.6.2
MarkupSafe==0.23
PyYAML==3.11
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
blist==1.3.6
cassandra-driver==3.0.0
certifi==2015.04.28
click==5.1
cqlengine==0.21.0
django-cassandra-engine==0.6.0
djangotoolbox==1.6.2
futures==3.0.3
livereload==2.4.0
mkdocs==0.14.0
mock==1.0.1
six==1.10.0
tornado==4.2.1
wsgiref==0.1.2
Could you confirm that this works for you too?
from django-cassandra-engine.
Hello @r4fek
Yes this works for me too.
[baali@jugaad] [~/analytics/django-cassandra-engine/testproject]
$ export DJANGO_SETTINGS_MODULE="settings.secondary_cassandra"
(tsenv)[baali@jugaad] [~/analytics/django-cassandra-engine/testproject]
$ python manage.py sync_cassandra
Creating keyspace db..
Syncing app.models.ExampleModel
Syncing app.models.ExampleModel2
Syncing app.models.TestProjectModel
(tsenv)[baali@jugaad] [~/analytics/django-cassandra-engine/testproject]
$ python manage.py shell
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from app.models import *
In [2]: ExampleModel.objects.create(id=1)
Out[2]: ExampleModel(id=1, created_at=None, deleted=False)
In [3]: list(ExampleModel.objects.all())
Out[3]: [ExampleModel(id=1, created_at=None, deleted=False)]
My pip freeze is:
$ pip freeze|grep cass
cassandra-driver==3.0.0
django-cassandra-engine==0.6.0
$ pip freeze | grep Django
Django==1.7.7
$ pip freeze | grep cql
cqlengine==0.21.0
I am not sure, seems like there is some issue with my configs/local setup. Sorry for the trouble I will try to cross check and update the thread.
from django-cassandra-engine.
Hi, @baali. Any updates on this? Did you manage to fix it?
from django-cassandra-engine.
Hey @r4fek. No, I started making direct queries. Sorry for the trouble, closing this.
from django-cassandra-engine.
Related Issues (20)
- Can't delete from admin - You cannot .filter() on a DjangoCassandraQuerySet which has been ordered using python HOT 1
- Support for values_list 'named' keyword argument
- Django 3.0 support HOT 4
- admin ui HOT 1
- TypeError: sql_flush() got an unexpected keyword argument 'reset_sequences' HOT 2
- Date must be mapped to DateField in serializers
- Creating keyspace but models are not syncing HOT 2
- Multiple cassandra configurations HOT 5
- Stale Cached Response on GET HOT 2
- Can I use Scylla's scylla-driver with this? HOT 1
- built-in ORM HOT 3
- Error while connecting to AWS Keyspace HOT 2
- django cassnadra migration HOT 1
- Does this library support connecting through TLS (if possible, with client cert auth)?
- Discord server HOT 1
- Can't connect to K8ssandra in minikube, problem with settings HOT 1
- django 3.2 LTS support & Python 3.7+ only
- Looking for a way to dump any CQL statement to logging
- cassandra.cluster.NoHostAvailable
- sync_cassandra command fails after syncing 1 model HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-cassandra-engine.