Skip to content

feature: Add ability to view the schema hash of each branch within the SDK #152

@ogenstad

Description

@ogenstad

Component

Python SDK

Describe the Feature Request

Currently the SDK stores a cache of the schema for each branch that it has interacted with. For long running processes this can lead to an issue when the schema of a given branch is updated and you try to interact with new objects. For instance if you add attributes to a node and the SDK has the old schema hashed it could lead to an error when you try to access an attribute that doesn't exist in the cached version of the schema.

The current workaround for this would be to refresh the schema in the SDK:

await client.schema.all(branch="my_branch", refresh=True)

A problem here is that it could be an expensive operation as it's typically not required. Each branch within Infrahub has a hash that identifies the schema configuration, it would be good if we could store this hash as we are loading the schema to the SDK cache. That way I'd be able to validate if the hash matches what I'd expect to see and if not I'd refresh the schema with the above command. If the cached branch has the same hash as the expected one there's no reason to refresh the cache.

Describe the Use Case

Lower overhead and avoid refetching the schema so often.

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions