You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Or use the factory directly to instantiate with a dict instead of using
49
+
# StorageConfig + create_factory
50
+
# from graphrag_storage.storage_factory import storage_factory
51
+
# storage = storage_factory.create(strategy="MyStorage", init_args={"some_setting": "My Setting"})
52
+
53
+
await storage.set("my_key", "value")
54
+
print(await storage.get("my_key"))
55
+
56
+
if__name__=="__main__":
57
+
asyncio.run(run())
58
+
```
59
+
60
+
### Details
61
+
62
+
By default, the `create_storage` comes with the following storage providers registered that correspond to the entries in the `StorageType` enum.
63
+
64
+
-`FileStorage`
65
+
-`AzureBlobStorage`
66
+
-`AzureCosmosStorage`
67
+
-`MemoryStorage`
68
+
69
+
The preregistration happens dynamically, e.g., `FileStorage` is only imported and registered if you request a `FileStorage` with `create_storage(StorageType.File, ...)`. There is no need to manually import and register builtin storage providers when using `create_storage`.
70
+
71
+
If you want a clean factory with no preregistered storage providers then directly import `storage_factory` and bypass using `create_storage`. The downside is that `storage_factory.create` uses a dict for init args instead of the strongly typed `StorageConfig` used with `create_storage`.
72
+
73
+
```python
74
+
from graphrag_storage.storage_factory import storage_factory
75
+
from graphrag_storage.file_storage import FileStorage
76
+
77
+
# storage_factory has no preregistered providers so you must register any
78
+
# providers you plan on using.
79
+
# May also register a custom implementation, see above for example.
msg=f"Container name must be between 3 and 63 characters long and contain only lowercase letters, numbers, or hyphens. Name provided was {container_name}."
0 commit comments