Comments (7)
Hi Dominick,
thanks for your input! I'll implement support for auth_provider in very near future. Stay tuned!
from django-cassandra-engine.
In the meantime you can add PlainTextAuthProvider (described here: http://datastax.github.io/python-driver/api/cassandra/auth.html#cassandra.auth.PlainTextAuthProvider) to connection options. Let me know if it solves your problem.
I'll add this option automatically if USER and PASSWORD options are set.
from django-cassandra-engine.
Yes I saw that this morning. I hadn't time yet to implement it completely
I'll finish the code and publish an example later tonight.
Thanks
Dominick
from django-cassandra-engine.
Here is how to get it to work:
At the top of your settings.py
file import the Authenticator class:
from cassandra.auth import PlainTextAuthProvider
Once the Authenticator class is imported you can tweak your database connection like the following.
DATABASES = {
'default': {
'ENGINE': 'django_cassandra_engine',
'NAME': 'mykeyspace',
'USER': 'user',
'PASSWORD': 'password',
'HOST': '127.0.0.1', # comma separeted hosts
'OPTIONS': {
'replication': {
'strategy_class': 'SimpleStrategy',
'replication_factor': 1
},
'connection': {
'consistency': ConsistencyLevel.ONE,
'lazy_connect': True,
'retry_connect': True,
'port': 9042,
'auth_provider': PlainTextAuthProvider(username='user', password='password'),
# + All connection options for cassandra.Cluster()
}
}
}
}
In my case the python manage.py syncdb
command line returned
python manage.py syncdb
Creating keyspace mykeyspace..
Thanks for your help, I am closing the issue.
Best
Dominick
from django-cassandra-engine.
Try the new version 0.1.4. Just add USER and PASSWORD, no need to define auth_provider in connection options.
Thanks for your contribution!
from django-cassandra-engine.
I confirm this works using the following connection pattern:
DATABASES = {
'default': {
'ENGINE': 'django_cassandra_engine',
'NAME': 'mykeyspace',
'USER': 'user',
'PASSWORD': 'password',
'HOST': '127.0.0.1', # comma separeted hosts
'OPTIONS': {
'replication': {
'strategy_class': 'SimpleStrategy',
'replication_factor': 1
},
'connection': {
'consistency': ConsistencyLevel.ONE,
'lazy_connect': True,
'retry_connect': True,
'port': 9042,
# + All connection options for cassandra.Cluster()
}
}
}
}
No more need to import from cassandra.auth import PlainTextAuthProvider
in the settings.py
file.
Thanks
Dominick
from django-cassandra-engine.
Thanks Rafal the fast fix is really appreciated.
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.