Create a new graph in database
(filename)
| 128 | help="Path of yaml file", |
| 129 | ) |
| 130 | def graph(filename): # noqa: F811 |
| 131 | """Create a new graph in database""" |
| 132 | if not is_valid_file_path(filename): |
| 133 | err(f"Invalid file: {filename}") |
| 134 | return |
| 135 | try: |
| 136 | graph = read_yaml_file(filename) |
| 137 | graph_id = create_graph(graph) |
| 138 | except Exception as e: |
| 139 | err(f"Failed to create graph: {str(e)}") |
| 140 | else: |
| 141 | succ(f"Create graph {graph['name']}(id={graph_id}) successfully.") |
| 142 | |
| 143 | |
| 144 | @delete.command() |