Skip to content
Snippets Groups Projects
Commit e2c63f34 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Remove name support in the cache

parent 89a9ef86
No related branches found
No related tags found
1 merge request!70Remove name support in the cache
Pipeline #78306 passed
...@@ -7,7 +7,6 @@ from arkindex_worker import logger ...@@ -7,7 +7,6 @@ from arkindex_worker import logger
SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements (
id VARCHAR(32) PRIMARY KEY, id VARCHAR(32) PRIMARY KEY,
parent_id VARCHAR(32), parent_id VARCHAR(32),
name TEXT NOT NULL,
type TEXT NOT NULL, type TEXT NOT NULL,
polygon TEXT, polygon TEXT,
initial BOOLEAN DEFAULT 0 NOT NULL, initial BOOLEAN DEFAULT 0 NOT NULL,
...@@ -17,7 +16,7 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( ...@@ -17,7 +16,7 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements (
CachedElement = namedtuple( CachedElement = namedtuple(
"CachedElement", "CachedElement",
["id", "name", "type", "polygon", "worker_version_id", "parent_id", "initial"], ["id", "type", "polygon", "worker_version_id", "parent_id", "initial"],
defaults=[None, 0], defaults=[None, 0],
) )
......
...@@ -476,7 +476,6 @@ class ElementsWorker(BaseWorker): ...@@ -476,7 +476,6 @@ class ElementsWorker(BaseWorker):
CachedElement( CachedElement(
id=convert_str_uuid_to_hex(created_ids[idx]["id"]), id=convert_str_uuid_to_hex(created_ids[idx]["id"]),
parent_id=parent_id_hex, parent_id=parent_id_hex,
name=element["name"],
type=element["type"], type=element["type"],
polygon=json.dumps(element["polygon"]), polygon=json.dumps(element["polygon"]),
worker_version_id=worker_version_id_hex, worker_version_id=worker_version_id_hex,
......
No preview for this file type
No preview for this file type
...@@ -14,7 +14,6 @@ ELEMENTS_TO_INSERT = [ ...@@ -14,7 +14,6 @@ ELEMENTS_TO_INSERT = [
CachedElement( CachedElement(
id=convert_str_uuid_to_hex("11111111-1111-1111-1111-111111111111"), id=convert_str_uuid_to_hex("11111111-1111-1111-1111-111111111111"),
parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"),
name="0",
type="something", type="something",
polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]),
worker_version_id=convert_str_uuid_to_hex( worker_version_id=convert_str_uuid_to_hex(
...@@ -24,7 +23,6 @@ ELEMENTS_TO_INSERT = [ ...@@ -24,7 +23,6 @@ ELEMENTS_TO_INSERT = [
CachedElement( CachedElement(
id=convert_str_uuid_to_hex("22222222-2222-2222-2222-222222222222"), id=convert_str_uuid_to_hex("22222222-2222-2222-2222-222222222222"),
parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"),
name="1",
type="something", type="something",
polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]),
worker_version_id=convert_str_uuid_to_hex( worker_version_id=convert_str_uuid_to_hex(
...@@ -78,10 +76,10 @@ def test_create_tables(): ...@@ -78,10 +76,10 @@ def test_create_tables():
name = table["name"] name = table["name"]
expected_table = expected_cache.cursor.execute( expected_table = expected_cache.cursor.execute(
f"SELECT sql FROM sqlite_master WHERE name = '{name}'" f"SELECT sql FROM sqlite_master WHERE name = '{name}'"
).fetchone() ).fetchone()["sql"]
generated_table = cache.cursor.execute( generated_table = cache.cursor.execute(
f"SELECT sql FROM sqlite_master WHERE name = '{name}'" f"SELECT sql FROM sqlite_master WHERE name = '{name}'"
).fetchone() ).fetchone()["sql"]
assert expected_table == generated_table assert expected_table == generated_table
......
...@@ -691,7 +691,6 @@ def test_create_elements(responses, mock_elements_worker_with_cache): ...@@ -691,7 +691,6 @@ def test_create_elements(responses, mock_elements_worker_with_cache):
CachedElement( CachedElement(
id=convert_str_uuid_to_hex("497f6eca-6276-4993-bfeb-53cbbbba6f08"), id=convert_str_uuid_to_hex("497f6eca-6276-4993-bfeb-53cbbbba6f08"),
parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"), parent_id=convert_str_uuid_to_hex("12341234-1234-1234-1234-123412341234"),
name="0",
type="something", type="something",
polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]), polygon=json.dumps([[1, 1], [2, 2], [2, 1], [1, 2]]),
worker_version_id=convert_str_uuid_to_hex( worker_version_id=convert_str_uuid_to_hex(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment