collection.config.update(object_ttl_config=...) merges the update into the schema it fetched, under a different key than the one the server returns. The server names the field objectTtlConfig, in schema.json#L1824 and in the Go tag at class.go#L50. The client writes objectTTLConfig here:
|
if self.objectTTLConfig is not None: |
|
schema["objectTTLConfig"] = self.objectTTLConfig.merge_with_existing( |
|
schema.get("objectTTLConfig", {}) |
The PUT carries both blocks:
from weaviate.classes.config import Reconfigure
from weaviate.collections.classes.config import _CollectionConfigUpdate
stored = {"objectTtlConfig": {"enabled": True, "deleteOn": "expiresAt", "defaultTtl": 3600, "filterExpiredObjects": False}}
update = _CollectionConfigUpdate(
object_ttl_config=Reconfigure.ObjectTTL.delete_by_date_property(property_name="customDate", filter_expired_objects=True)
)
print(update.merge_with_existing(stored))
# main 38f30c1
{'objectTtlConfig': {'enabled': True, 'deleteOn': 'expiresAt', 'defaultTtl': 3600, 'filterExpiredObjects': False}, 'objectTTLConfig': {'enabled': True, 'filterExpiredObjects': True, 'deleteOn': 'customDate', 'defaultTtl': 0}}
The update still reaches the server for two reasons. Go's encoding/json matches keys without regard to case, and the client puts its key last, so it overlays the stale block. With the two blocks in the other order, a live server stores nothing from the update:
# raw PUT /v1/schema/<class> against semitechnologies/weaviate:1.39.7, update block {'enabled': True, 'filterExpiredObjects': True}
A both blocks, objectTTLConfig last 200 stored filterExpiredObjects=True
B both blocks, objectTTLConfig first 200 stored filterExpiredObjects=False
C only objectTtlConfig, fully merged 200 stored filterExpiredObjects=True
A rename of the five occurrences to objectTtlConfig sends one block and stores the same state as main. python -m pytest test/ gives 526 passed, as on main without it, and the five TTL integration tests pass against 1.39.7. On top of #2171's head the PUT carries one block with defaultTtl: 3600, and test/ gives 496 passed, as on that head alone. No test pins either spelling today.
#2171 lists this mismatch as awaiting a maintainer decision. Related: #2170.
@g-despot do you want the rename, with a test that pins objectTtlConfig, as a pull request? cc @dirkkul, as the key came in with ef6e0e3.
collection.config.update(object_ttl_config=...)merges the update into the schema it fetched, under a different key than the one the server returns. The server names the fieldobjectTtlConfig, in schema.json#L1824 and in the Go tag at class.go#L50. The client writesobjectTTLConfighere:weaviate-python-client/weaviate/collections/classes/config.py
Lines 1748 to 1750 in 38f30c1
The PUT carries both blocks:
The update still reaches the server for two reasons. Go's
encoding/jsonmatches keys without regard to case, and the client puts its key last, so it overlays the stale block. With the two blocks in the other order, a live server stores nothing from the update:A rename of the five occurrences to
objectTtlConfigsends one block and stores the same state as main.python -m pytest test/gives 526 passed, as on main without it, and the five TTL integration tests pass against 1.39.7. On top of #2171's head the PUT carries one block withdefaultTtl: 3600, andtest/gives 496 passed, as on that head alone. No test pins either spelling today.#2171 lists this mismatch as awaiting a maintainer decision. Related: #2170.
@g-despot do you want the rename, with a test that pins
objectTtlConfig, as a pull request? cc @dirkkul, as the key came in with ef6e0e3.