Skip to content
This repository was archived by the owner on Aug 27, 2023. It is now read-only.
This repository was archived by the owner on Aug 27, 2023. It is now read-only.

engine.create_schema() fails to create tables #37

@dmitryzv

Description

@dmitryzv

When there are more than 100 table in user's account and a table for a model already exists engine.create_schema() will fail with:
ResourceInUseException: Table already exists: table-name

This happens because in engine.py line 204 the call to:

        tablenames = set(self.dynamo.list_tables())

will return 100 first tables and in model_meta.py line 440:

        if tablename in tablenames:
            return None

will miss the fact that the table already exists.

Proposed solution:
For each table to create deliberately validate that it doesn't exist. Like (proto-code):

        for model in self._ddb_engine.models.itervalues():
            if not self._ddb_engine.dynamo.describe_table(model.meta_.ddb_tablename()):
                model.meta_.create_dynamo_schema(self._ddb_engine.dynamo, tablenames=[], wait=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions