diff --git a/arkindex_worker/cache.py b/arkindex_worker/cache.py index 2a36c219ee85d4678180e2fe1c4c2e452e30828b..9bb6c0fa8aa3d5089354016db0dbed097fd82f54 100644 --- a/arkindex_worker/cache.py +++ b/arkindex_worker/cache.py @@ -7,7 +7,6 @@ from arkindex_worker import logger SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( id VARCHAR(32) PRIMARY KEY, parent_id VARCHAR(32), - name TEXT NOT NULL, type TEXT NOT NULL, polygon TEXT, initial BOOLEAN DEFAULT 0 NOT NULL, @@ -17,7 +16,7 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( CachedElement = namedtuple( "CachedElement", - ["id", "name", "type", "polygon", "worker_version_id", "parent_id", "initial"], + ["id", "type", "polygon", "worker_version_id", "parent_id", "initial"], defaults=[None, 0], ) diff --git a/arkindex_worker/worker.py b/arkindex_worker/worker.py index ec61b14b3677dcdc7bf7a89ebb1c15966b2213a0..541cc2869d05bf9b208c7daa3c202342d25c3142 100644 --- a/arkindex_worker/worker.py +++ b/arkindex_worker/worker.py @@ -476,7 +476,6 @@ class ElementsWorker(BaseWorker): CachedElement( id=convert_str_uuid_to_hex(created_ids[idx]["id"]), parent_id=parent_id_hex, - name=element["name"], type=element["type"], polygon=json.dumps(element["polygon"]), worker_version_id=worker_version_id_hex, diff --git a/tests/data/cache/lines.sqlite b/tests/data/cache/lines.sqlite index 4294b9b0f3789629fb466debb0d8931f589f9c59..ea881e4f1bb2143f560ca81ac6435842494c95f5 100644 Binary files a/tests/data/cache/lines.sqlite and b/tests/data/cache/lines.sqlite differ diff --git a/tests/data/cache/tables.sqlite b/tests/data/cache/tables.sqlite index be29e25631f18d386ad8c644ead09e91792a3d43..efc107cd7506757f92df1ee011b670738228b8b2 100644 Binary files a/tests/data/cache/tables.sqlite and b/tests/data/cache/tables.sqlite differ diff --git a/tests/test_cache.py b/tests/test_cache.py index fde2c681189a99fdce2476f38533fb91ebcb7285..fb3c28a125417e1d480f19627fdcf54f341f11ae 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -14,7 +14,6 @@ ELEMENTS_TO_INSERT = [ CachedElement( id=convert_str_uuid_to_hex("11111111-1111-1111-1111-111111111111"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), - name="0", type="something", polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), worker_version_id=convert_str_uuid_to_hex( @@ -24,7 +23,6 @@ ELEMENTS_TO_INSERT = [ CachedElement( id=convert_str_uuid_to_hex("22222222-2222-2222-2222-222222222222"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), - name="1", type="something", polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), worker_version_id=convert_str_uuid_to_hex( @@ -78,10 +76,10 @@ def test_create_tables(): name = table["name"] expected_table = expected_cache.cursor.execute( f"SELECT sql FROM sqlite_master WHERE name = '{name}'" - ).fetchone() + ).fetchone()["sql"] generated_table = cache.cursor.execute( f"SELECT sql FROM sqlite_master WHERE name = '{name}'" - ).fetchone() + ).fetchone()["sql"] assert expected_table == generated_table diff --git a/tests/test_elements_worker/test_elements.py b/tests/test_elements_worker/test_elements.py index 776885fab29a040d43ec9969f16f9d0e65b66913..b0ad3486fbfad16061883aa5d948b5240d55c122 100644 --- a/tests/test_elements_worker/test_elements.py +++ b/tests/test_elements_worker/test_elements.py @@ -691,7 +691,6 @@ def test_create_elements(responses, mock_elements_worker_with_cache): CachedElement( id=convert_str_uuid_to_hex("497f6eca-6276-4993-bfeb-53cbbbba6f08"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), - name="0", type="something", polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), worker_version_id=convert_str_uuid_to_hex(