diff --git a/test/integration/test_integration.py b/test/integration/test_integration.py index f87b4af..a6e43de 100644 --- a/test/integration/test_integration.py +++ b/test/integration/test_integration.py @@ -49,7 +49,7 @@ def test_collection_lifecycle(collection_manager: CollectionManager): auto_tenant_creation=False, auto_tenant_activation=False, vectorizer="contextionary", - auto_schema=True, + force_auto_schema=True, ) # Verify collection exists @@ -97,7 +97,7 @@ def test_multiple_collections(collection_manager: CollectionManager): auto_tenant_creation=False, auto_tenant_activation=False, vectorizer="contextionary", - auto_schema=True, + force_auto_schema=True, ) assert collection_manager.client.collections.exists(col) finally: @@ -128,7 +128,7 @@ def test_shard_operations( auto_tenant_creation=False, auto_tenant_activation=False, vectorizer="transformers", - auto_schema=True, + force_auto_schema=True, ) # Get shard info @@ -169,7 +169,7 @@ def test_error_handling(collection_manager: CollectionManager): auto_tenant_creation=False, auto_tenant_activation=False, vectorizer="transformers", - auto_schema=True, + force_auto_schema=True, ) with pytest.raises(Exception): @@ -185,7 +185,7 @@ def test_error_handling(collection_manager: CollectionManager): auto_tenant_creation=False, auto_tenant_activation=False, vectorizer="transformers", - auto_schema=True, + force_auto_schema=True, ) finally: # Test deleting non-existent collection diff --git a/test/unittests/test_managers/test_collection_manager.py b/test/unittests/test_managers/test_collection_manager.py index fdd1bb4..f6b69f1 100644 --- a/test/unittests/test_managers/test_collection_manager.py +++ b/test/unittests/test_managers/test_collection_manager.py @@ -27,7 +27,7 @@ def test_create_collection(mock_client): multitenant=False, auto_tenant_creation=False, auto_tenant_activation=False, - auto_schema=False, + force_auto_schema=False, shards=1, vectorizer=None, ) @@ -65,7 +65,7 @@ def test_create_existing_collection(mock_client): multitenant=False, auto_tenant_creation=False, auto_tenant_activation=False, - auto_schema=False, + force_auto_schema=False, shards=1, vectorizer=None, ) @@ -101,7 +101,7 @@ def test_create_collection_failure(mock_client): multitenant=False, auto_tenant_creation=False, auto_tenant_activation=False, - auto_schema=False, + force_auto_schema=False, shards=1, vectorizer=None, ) diff --git a/weaviate_cli/commands/create.py b/weaviate_cli/commands/create.py index 7f86191..01dcd3e 100644 --- a/weaviate_cli/commands/create.py +++ b/weaviate_cli/commands/create.py @@ -57,7 +57,11 @@ def create() -> None: is_flag=True, help="Enable auto tenant activation (default: False).", ) -@click.option("--auto_schema", default=True, help="Enable auto-schema (default: True).") +@click.option( + "--force_auto_schema", + is_flag=True, + help="Force auto-schema (default: False). If passed, no properties will be added to the collection and it will be the auto-schema the one that infers the properties.", +) @click.option("--shards", default=1, help="Number of shards (default: 1).") @click.option( "--vectorizer", @@ -77,7 +81,7 @@ def create_collection_cli( multitenant: bool, auto_tenant_creation: bool, auto_tenant_activation: bool, - auto_schema: bool, + force_auto_schema: bool, shards: int, vectorizer: Optional[str], ) -> None: @@ -98,7 +102,7 @@ def create_collection_cli( multitenant=multitenant, auto_tenant_creation=auto_tenant_creation, auto_tenant_activation=auto_tenant_activation, - auto_schema=auto_schema, + force_auto_schema=force_auto_schema, shards=shards, vectorizer=vectorizer, ) diff --git a/weaviate_cli/managers/collection_manager.py b/weaviate_cli/managers/collection_manager.py index 496b7fa..307c6c9 100644 --- a/weaviate_cli/managers/collection_manager.py +++ b/weaviate_cli/managers/collection_manager.py @@ -55,7 +55,7 @@ def create_collection( multitenant: bool, auto_tenant_creation: bool, auto_tenant_activation: bool, - auto_schema: bool, + force_auto_schema: bool, shards: int, vectorizer: Optional[str], ) -> None: @@ -152,7 +152,7 @@ def create_collection( auto_tenant_activation=auto_tenant_activation, ), vectorizer_config=(vectorizer_map[vectorizer] if vectorizer else None), - properties=properties if auto_schema else None, + properties=properties if not force_auto_schema else None, ) except Exception as e: diff --git a/weaviate_cli/managers/data_manager.py b/weaviate_cli/managers/data_manager.py index 2762043..a0585aa 100644 --- a/weaviate_cli/managers/data_manager.py +++ b/weaviate_cli/managers/data_manager.py @@ -101,6 +101,7 @@ def create_single_object() -> Dict: "title": f"{prefix}title" + get_random_string(10), "genres": f"{prefix}genre" + get_random_string(3), "keywords": f"{prefix}keywords" + get_random_string(3), + "director": f"{prefix}director" + get_random_string(3), "popularity": float(random.randint(1, 200)), "runtime": f"{prefix}runtime" + get_random_string(3), "cast": f"{prefix}cast" + get_random_string(3),