Skip to content

Commit

Permalink
Merge pull request #87 from weaviate/jose/fix_data_inconsistencies
Browse files Browse the repository at this point in the history
Add missing director property with --randomize.
  • Loading branch information
jfrancoa authored Oct 30, 2024
2 parents c142c14 + c447412 commit 647e7df
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
10 changes: 5 additions & 5 deletions test/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/unittests/test_managers/test_collection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down
10 changes: 7 additions & 3 deletions weaviate_cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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:
Expand All @@ -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,
)
Expand Down
4 changes: 2 additions & 2 deletions weaviate_cli/managers/collection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions weaviate_cli/managers/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 647e7df

Please sign in to comment.