r4fek / django-cassandra-engine

Django Cassandra Engine - the Cassandra backend for Django
BSD 2-Clause "Simplified" License
365 stars 85 forks source link

sync_cassandra only process one database #12

Closed mat-green closed 9 years ago

mat-green commented 9 years ago

The indentation of line 19 in sync_cassandra seems incorrect leading to only one django_cassandra_engine database being processed.

r4fek commented 9 years ago

And what's the reason for having more than one connection to Cassandra?

mat-green commented 9 years ago

My assumption is that you define a different connection for different keyspaces or is this incorrect?

danandersonasc commented 9 years ago

The reverse question is a better one: what's the reason for restricting Django to just one Cassandra connection when syncdb does not?

r4fek commented 9 years ago

I see your point now. This requires more than just changing one line in the source code. I'll look into this.

r4fek commented 9 years ago

I guess I managed to fix this one. From now:

  1. sync_cassandra syncs all keyspaces defined in settings (see testproject/settings/multi_cassandra.py for an example)
  2. You need to set Model.__keyspace__ on each model if you need to use more than one keyspace.

@mat-green @danandersonasc could you guys try it and let me know if this works as expected?

r4fek commented 9 years ago

I thinks it works. Closing.

danandersonasc commented 9 years ago

Agreed, it is working. Thanks!