Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync_cassandra command fails after syncing 1 model #165

Open
psraghuveer opened this issue Nov 3, 2022 · 1 comment
Open

sync_cassandra command fails after syncing 1 model #165

psraghuveer opened this issue Nov 3, 2022 · 1 comment

Comments

@psraghuveer
Copy link

psraghuveer commented Nov 3, 2022

Hi,

I am trying to sync 3 tables with Amazon Keyspace. I have setup everything according to the docs and some information I could find on Stackoverflow answers. But, when I run python manage.py sync_cassandra, it errors out after syncing 1 model, while there are 3 models to be synced. However, I can see that the table is created on Amazon Keyspace. When I run the command again, the other tables get synced - but it is quite random. What might be causing this to error out?

My configuration:

{
        "ENGINE": "django_cassandra_engine",
        "NAME": os.getenv("AWS_KEYSPACE_NAME"),
        "HOST": os.getenv("AWS_KEYSPACE_HOST"),
        "OPTIONS": {
            "replication": {
                "strategy_class": "SimpleStrategy",
                "replication_factor": 1,
            },
            "connection": {
                "retry_connect": True,
                "consistency": ConsistencyLevel.LOCAL_QUORUM,
                "port": 9142,
                "ssl_context": ssl_context,
                "auth_provider": PlainTextAuthProvider(username=os.getenv("AWS_KEYSPACE_USERNAME"), password=os.getenv("AWS_KEYSPACE_PASSWORD")),
            },
        },
    }

The error:

Syncing apps.notifications.models.EmailNotificationLog
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django_cassandra_engine/management/commands/sync_cassandra.py", line 101, in handle
    self.sync(alias)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/django_cassandra_engine/management/commands/sync_cassandra.py", line 87, in sync
    management.sync_table(model, keyspaces=[keyspace], connections=[alias])
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/cassandra/cqlengine/management.py", line 190, in sync_table
    _sync_table(m, connection=connection)
  File "/Users/raghuveer/qoohoo/bagheera/venv/lib/python3.8/site-packages/cassandra/cqlengine/management.py", line 274, in _sync_table
    table = cluster.metadata.keyspaces[ks_name].tables[raw_cf_name]
KeyError: 'email_notification_log'
@westover
Copy link

I noticed with Amazon Keyspaces that there is a lag with model creation that seems to cause it to fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants