Export data from WhyHow¶
Using the export_all()
utility, you can export your workspaces, schemas, graphs, chunks, triples, and nodes from all your WhyHow workspaces or from a specific workspace. This utility function will find all the data within your workspaces, and download it to a json file.
Export from all workspaces¶
To export data from all your workspaces, just run the
In [ ]:
Copied!
# To export data from all your workspaces, just run `export_all`
from whyhow import WhyHow
client = WhyHow(api_key='da15fc1e08f90ed3872f40a0f8bd518d', base_url="https://api.whyhow.ai")
response = client.export_all()
# To export data from a specific workspace, just provide a workspace_id as an argument to the export method
# response = client.export(workspace_id='5f5d7c4e2b2d7c001b8f8d4c')
# To export data from all your workspaces, just run `export_all`
from whyhow import WhyHow
client = WhyHow(api_key='da15fc1e08f90ed3872f40a0f8bd518d', base_url="https://api.whyhow.ai")
response = client.export_all()
# To export data from a specific workspace, just provide a workspace_id as an argument to the export method
# response = client.export(workspace_id='5f5d7c4e2b2d7c001b8f8d4c')
Starting export of WhyHow data. Processing workspace 66a0349bdd8703cbcc9a9978 (Companies (demo)) Exported data to whyhow_dump_20241129_165506.json
The data will be output in the following format:
[{
"workspaces": [
{
"workspace_id": "6483e9b2a74e4cda9b2f8c93",
"name": "Sample Workspace",
"chunks": [
{
"chunk_id": "64b3f9e1d73c41f48792e8b7",
"created_at": "2024-07-25T16:56:42.425000",
"updated_at": "2024-07-25T16:56:42.425000",
"document_id": null,
"workspace_ids": ["6483e9b2a74e4cda9b2f8c93"],
"metadata": {
"language": "en",
"length": 104,
"size": 153,
"data_source_type": "manual",
"index": null,
"page": null,
"start": null,
"end": null
},
"content": "John Smith is 46 years old and lives in New York, NY. He is a software engineer. He has a dog named Max.",
"embedding": null,
"tags": [],
"user_metadata": {}
}
],
"graphs": [
{
"graph_id": "64b3f9e1d73c41f48792e9c4",
"name": "Sample Graph",
"workspace_id": "6483e9b2a74e4cda9b2f8c93",
"created_at": "2024-07-25T16:56:42.425000",
"updated_at": "2024-07-25T16:56:42.425000",
"schema_id": "64b3f9e1d73c41f48792eaf1",
"status": "ready",
"errors": [],
"public": false,
"schema": {
"schema_id": "64b3f9e1d73c41f48792eaf1",
"name": "Sample Schema",
"entities": [
{
"name": "person",
"description": "A person mentioned in a document.",
"fields": []
},
{
"name": "profession",
"description": "A job that a person has.",
"fields": []
}
],
"relations": [
{
"name": "has_job",
"description": "A relationship indicating that a person has a profession."
}
],
"patterns": [
{
"head": {
"name": "person",
"description": "A person mentioned in a document.",
"fields": []
},
"relation": {
"name": "has_job",
"description": "A relationship indicating that a person has a profession."
},
"tail": {
"name": "profession",
"description": "A job that a person has.",
"fields": []
},
"description": "Indicates that a person has a profession."
}
],
"workspace_id": "6483e9b2a74e4cda9b2f8c93",
"created_at": "2024-07-25T16:56:42.425000",
"updated_at": "2024-07-25T16:56:42.425000"
},
"triples": [
{
"triple_id": "66a283ce8e5461730aa82866",
"head": {
"node_id": "66a283ce8e5461730aa82843",
"label": "person",
"name": "John Smith",
"chunk_ids": [
"64b3f9e1d73c41f48792e8b7"
],
"properties": {},
"created_at": null,
"updated_at": null,
"graph_id": null
},
"tail": {
"node_id": "66a283ce8e5461730aa82840",
"label": "profession",
"name": "Software Engineer",
"chunk_ids": [
"64b3f9e1d73c41f48792e8b7"
],
"properties": {},
"created_at": null,
"updated_at": null,
"graph_id": null
},
"relation": {
"name": "has_job",
"properties": {}
},
"chunk_ids": [
"64b3f9e1d73c41f48792e8b7"
],
"created_at": null,
"updated_at": null,
"properties": null,
"graph_id": null,
"embedding": null
}
],
"nodes": [
{
"node_id": "66a283ce8e5461730aa82843",
"label": "person",
"name": "John Smith",
"chunk_ids": [
"64b3f9e1d73c41f48792e8b7"
],
"properties": {},
"created_at": "2024-07-25T16:56:42.425000",
"updated_at": "2024-07-25T16:56:42.425000",
"graph_id": "66a283ca8e5461730aa82827"
},
{
"node_id": "66a283ce8e5461730aa82840",
"label": "profession",
"name": "Software Engineer",
"chunk_ids": [
"64b3f9e1d73c41f48792e8b7"
],
"properties": {},
"created_at": "2024-07-25T16:56:42.425000",
"updated_at": "2024-07-25T16:56:42.425000",
"graph_id": "66a283ca8e5461730aa82827"
}
]
}
]
}
]
}]